Class DCplxTrans (version 0.18)

Description: A complex transformation

A complex transformation provides magnification, mirroring at the x-axis, rotation by an arbitary angle and a displacement. A complex transformation provides a superset of the simple transformation. In many applications, a complex transformation computes floating-point coordinates to minimize rounding effects. This version can transform floating-point coordinate objects.

Class overview

Index

Method Overview

[static] DCplxTrans from_itrans( CplxTrans int_trans )Conversion constructor from an integer coordinate transformation
[static] DCplxTrans newCreates a unit transformation
[static] DCplxTrans new( int f )Conversion constructor from a fixpoint transformation
[static] DCplxTrans new( double m )Constructor from a magnification
[static] DCplxTrans new( DTrans t, double m )Constructor from a simple transformation and a magnification
[static] DCplxTrans new( DTrans t )Constructor from a simple transformation alone
[static] DCplxTrans new( double mag, double rot, bool mirrx, DPoint u )The standard constructor using magnification, angle, mirror flag and displacement
[const] DCplxTrans invertedInversion
DCplxTrans invertIn-place inversion
[const] double ctrans( double d )The transformation of a distance
[const] DPoint trans( DPoint p )The transformation of a point
[const] DCplxTrans *( DCplxTrans t )Multiplication (concatenation) of transformations
[const] bool <( DCplxTrans )A sorting criterion
[const] bool ==( DCplxTrans )Equality test
[const] bool !=( DCplxTrans )Inequality test
[const] string to_sString conversion
[const] const ref DPoint dispAccessor to the point
disp=( DPoint u )Write accessor to the point
[const] int rotReturn the respective rotation code if possible
[const] bool is_mirror?Accessor to the mirror flag
mirror=( bool m )Write accessor to the mirror flag
[const] bool is_unity?Test, whether this is a unit transformation
[const] bool is_ortho?Test, if the transformation is an orthogonal transformation
[const] DTrans s_transExtract the simple transformation part
[const] double angleRead accessor for the angle
angle=( double a )Write accessor for the angle
[const] double magRead accessor to the magnification
[const] bool is_mag?Test, if the transformation is a magnifying one
mag=( double m )Write accessor to the magnification
[static] int r0Angle/mirror code for the "unrotated" transformation
[static] int r90Angle/mirror code for the "rotated by 90 degree counterclockwise" transformation
[static] int r180Angle/mirror code for the "rotated by 180 degree counterclockwise" transformation
[static] int r270Angle/mirror code for the "rotated by 270 degree counterclockwise" transformation
[static] int m0Angle/mirror code for the "mirrored at the x-axis" transformation
[static] int m45Angle/mirror code for the "mirrored at the 45 degree axis" transformation
[static] int m90Angle/mirror code for the "mirrored at the y (90 degree) axis" transformation
[static] int m135Angle/mirror code for the "mirrored at the 135 degree axis" transformation
assign( DCplxTrans other )Assign the contents of another object to self
[const] DCplxTrans dupCreates a copy of self.
destroyExplicitly destroy the object
[const] bool destroyedTell, if the object was destroyed

[const] bool !=( DCplxTrans )

Description: Inequality test

[const] DCplxTrans *( DCplxTrans t )

Description: Multiplication (concatenation) of transformations

The * operator returns self*t ("t is applied before this transformation").

t:The transformation to apply before
returns:The modified transformation

[const] bool <( DCplxTrans )

Description: A sorting criterion

[const] bool ==( DCplxTrans )

Description: Equality test

[const] double angle

Description: Read accessor for the angle

To check, if the transformation represents a rotation by a angle that is a multiple of 90 degree, use this predicate.

returns:The rotation angle this transformation provides in degree units (0..360 deg).

angle=( double a )

Description: Write accessor for the angle

a:The new angle

assign( DCplxTrans other )

Description: Assign the contents of another object to self

This method assigns the contents of another object to self. This is a deep copy that does not only copy the reference but the actual content.

[const] double ctrans( double d )

Description: The transformation of a distance

The "ctrans" method transforms the given distance. e = t(d). For the simple transformations, there is no magnification and no modification of the distance therefore.

d:The distance to transform
returns:The transformed distance

destroy

Description: Explicitly destroy the object

Explicitly destroy the object on C++ side if it was owned by the Ruby interpreter. Subsequent access to this object will throw an exception. If the object is not owned by Ruby, this method will do nothing.

[const] bool destroyed

Description: Tell, if the object was destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

[const] const ref DPoint disp

Description: Accessor to the point

disp=( DPoint u )

Description: Write accessor to the point

u:The new displacement

[const] DCplxTrans dup

Description: Creates a copy of self.

[static] DCplxTrans from_itrans( CplxTrans int_trans )

Description: Conversion constructor from an integer coordinate transformation

DCplxTrans invert

Description: In-place inversion

Inverts the transformation and replaces this transformation by the inverted one.

returns:The inverted transformation

[const] DCplxTrans inverted

Description: Inversion

Returns the inverted transformation

returns:The inverted transformation

[const] bool is_mag?

Description: Test, if the transformation is a magnifying one

This is the recommended test for checking if the transformation represents a magnification.

[const] bool is_mirror?

Description: Accessor to the mirror flag

[const] bool is_ortho?

Description: Test, if the transformation is an orthogonal transformation

If the rotation is by a multiple of 90 degree, this method will return true.

[const] bool is_unity?

Description: Test, whether this is a unit transformation

[static] int m0

Description: Angle/mirror code for the "mirrored at the x-axis" transformation

[static] int m135

Description: Angle/mirror code for the "mirrored at the 135 degree axis" transformation

[static] int m45

Description: Angle/mirror code for the "mirrored at the 45 degree axis" transformation

[static] int m90

Description: Angle/mirror code for the "mirrored at the y (90 degree) axis" transformation

[const] double mag

Description: Read accessor to the magnification

mag=( double m )

Description: Write accessor to the magnification

m:The new magnification

mirror=( bool m )

Description: Write accessor to the mirror flag

"mirroring" describes a reflection at the x-axis which is included in the transformation prior to rotation.

m:The new mirror flag

[static] DCplxTrans new( DTrans t, double m )
synonym: [static] DCplxTrans new_tm( DTrans t, double m )

Description: Constructor from a simple transformation and a magnification

Creates a magnifying transformation from a simple transformation and a magnification.

[static] DCplxTrans new( DTrans t )
synonym: [static] DCplxTrans new_t( DTrans t )

Description: Constructor from a simple transformation alone

Creates a magnifying transformation from a simple transformation and a magnification of 1.0.

[static] DCplxTrans new

Description: Creates a unit transformation

[static] DCplxTrans new( int f )
synonym: [static] DCplxTrans new_f( int f )

Description: Conversion constructor from a fixpoint transformation

This constructor will create a transformation with a fixpoint transformation but no displacement.

f:The rotation/mirror code (r0 .. m135 constants)

[static] DCplxTrans new( double m )
synonym: [static] DCplxTrans new_m( double m )

Description: Constructor from a magnification

Creates a magnifying transformation without displacement and rotation given the magnification m.

[static] DCplxTrans new( double mag, double rot, bool mirrx, DPoint u )
synonym: [static] DCplxTrans new_mrmu( double mag, double rot, bool mirrx, DPoint u )

Description: The standard constructor using magnification, angle, mirror flag and displacement

The sequence of operations is: magnification, mirroring at x axis, rotation, application of displacement.

mag:The magnification
rot:The rotation angle in units of degree
mirrx:True, if mirrored at x axis
u:The displacement

[static] int r0

Description: Angle/mirror code for the "unrotated" transformation

[static] int r180

Description: Angle/mirror code for the "rotated by 180 degree counterclockwise" transformation

[static] int r270

Description: Angle/mirror code for the "rotated by 270 degree counterclockwise" transformation

[static] int r90

Description: Angle/mirror code for the "rotated by 90 degree counterclockwise" transformation

[const] int rot

Description: Return the respective rotation code if possible

If this transformation is orthogonal (is_ortho () == true), then this method will return the corresponding fixpoint transformation, not taking into account magnification and displacement. If the transformation is not orthogonal, the result reflects the quadrant the rotation goes into with the guarantee to reproduce the correct quadrant in the exact case.

[const] DTrans s_trans

Description: Extract the simple transformation part

The simple transformation part does not reflect magnification not arbitrary angles. On the angle contribution up to a multiple of 90 degree is reflected.

[const] string to_s

Description: String conversion

[const] DPoint trans( DPoint p )

Description: The transformation of a point

The "trans" method transforms the given point. q = t(p)

p:The point to transform
returns:The transformed point