Glade Reference


polygon class

The polygon class is derived from a shape. This class is normally created in a cellView using the dbCreatePoly() function. Note that dbCreatePoly() will create a square or a rectangle if the polygon has 4 points. A polygon is represented by a series of points, which represent the vertices of the polygon. There is an implicit edge between the first and last point.

 

Rect b = p.bBox()

Get the bounding box of this polygon.

 

p.bBox(Rect b)

Set the bounding box of this polygon. Not useful and will throw an exception if called.

 

db_Type t = p.objType()

Returns the object type of this polygon as POLYGON.

 

char *name = p.objName()

Returns the object name of this polygon as "POLYGON".

 

int n = p.nPoints()

Returns the number of points of the polygon's boundary. Note that polygons are not closed as they are in GDS2.

 

Point * pts = p.ptlist()

Returns the point list of this polygon as a C array of Points.

 

Point p = p[index]

Returns the Point p at the index into the list of points.

 

p.bias(int bias, double grid)

Bias this polygon by bias, snapping to the grid grid.

 

p.scale(double scale, double grid)

Scale this polygon by scale, snapping to the grid grid.

 

int d = p.getNearestEdge(Point p, segment &s)

Get the distance of the nearest segment s of this polygon to the point p;

 

int d = p.getNearestVertex(Point p, vertex &s)

Get the distance of the nearest vertex s of this polygon to the point p;

 

bool ptInPoly(Point p)

Returns true if the point in inside or on the edge of the polygon.

 

double a = p.area()

Get the area of this polygon.

 

int p = p.perimeter()

Get the perimeter of this polygon.

 

p.transform(dbTransform trans)

Transform this polygon using trans.

 

p.Move(cellView *cv, Point delta, bool opt = True)

Move this polygon by distance delta. If opt is True then the database is re-optimised for the new polygon position. If there are a lot of objects to move it makes sense to turn this off and instead use the cellView update() function after moving them all.

 

dbObj *obj = p.Copy(cellView cv, Point delta, int layer = -1)

Copy this polygon to cellView cv, with offset delta. If layerNum is non-negative the polygon will be copied to the new layer number.

 

dbObj *obj = p.Flatten(cellView cv, dbTransform trans)

Flatten this polygon into cellView cv with transformation trans.

 

p.Stretch(Point delta, segment seg)

Stretch segment seg of this polygon by delta.

 

p.Stretch(Point delta, vertex v)

Stretch vertex v of this polygon by delta.

 

p.compressPoints()

Removes colinear points, sets the point order to be counterclockwise and sets the first point to be the smallest in X and Y.

 

bool p.selfIntersecting()

Returns true if the polygon is self-intersecting.

 

Contents|Index

Copyright © Peardrop Design 2016.