Glade Reference


dbTransform

The dbTransform class contains functions to transform coordinates in subcells placed with offset, rotation and magnification.

All of this code is based on the fact that a point with coordinates x, y can be transformed by a transformation matrix T by:

[x', y', 1] = [x, y, 1]T

The transformation matrix for an offset (a,b) with no rotation or magnification can be described as

T = [ 1 0 0 ]
[ 0 1 0 ]
[ a b 1 ]

Rotations are e.g.

T90 = [ 0 1 0 ]
[ -1 0 0 ]
[ 0 0 1 ]

trans = dbTransform(int orient, Point p, double scale)

Construct a dbTransform with orientation orient, origin p and magnification scale. The orientation can be specified by the constants R0, R90, R180, R270, MX, MXR90, My, MYR90.

 

trans = dbTransform(int orient, Point p)

trans = dbTransform(int orient, int x, int y)

Construct a dbTransform with orientation orient, origin p or x/y.

 

trans = dbTransform(int orient)

Construct a dbTransform with orientation orient.

 

trans = dbTransform()

Construct a dbTransform with orientation R0.

 

trans.invert()

Invert a transformation matrix

 

trans.inverseTransformRect(Rect box)

Transform a Rect by the inverse of the transformation matrix. Useful if you want to take a Rect and transform it into the coordinate space of an instance with a transform. For example if you want to find if any shapes in an instance overlap a search box for a top level cell, use the inverse transform of the search box on all the instance's shapes. This means doing just one transform of the search box rather than one transform for each shape in the instance.

 

trans.inverseTransformPoint(Point p)

trans.inverseTransformPoint(int x, int y)

Transform a Point by the inverse of the transformation matrix

 

trans.transformRect(Rect box)

Transform a Rect by the transformation matrix

 

trans.transformRect(Rect box, Point origin)

Transform a Rect by the transformation matrix about a point origin.

 

trans.transformPoint(Point p)

Transform a Point by the transformation matrix

 

trans.transformPoint(Point p, Point origin)

Transform a point by the transformation matrix about a point origin.

 

trans.transformPointList(Point *ptlist, int size)

Transform an array of points of size size by the transformation matrix.

 

trans.transformPointList(Point *ptlist, int size, Point origin)

Transform an array of points of size size by the transformation matrix about a point origin.

 

trans.setOrient(int orient)

Set the transformation matrix orientation

 

int orient = trans.getOrient()

Get the transformation matrix orientation.

 

trans.setOrigin(Point p)

trans.setOrigin(int x, int y)

Set the transformation origin.

 

Point origin = trans.getOrigin()

Get the transformation origin.

 

trans.setMag(double scale)

Set the transformation matrix scale.

 

bool swapped = trans.isXYSwapped()

Returns True if the transformation is such that the objects XY coordinates would be swapped, e,g, if the object is R90.

 

Contents|Index

Copyright © Peardrop Design 2016.