gml_Geometry.tcl File Reference

gmlRectToShape rect

Return a list of vertices corresponding to rect.

gmlVectSub v1 v2

Returns the vectors resulting from the substraction of vectors v1 and v2. v1 and v2 must be of the same dimension.

gmlRectArea l t r b

Return the area of a rectangle, in pixels

gmlGRItemScale canvas tag s

Scale of a 2D scaling vector s all the items of the canvas canvas that have the tag tag.

gmlLineShape pt1 pt2 { width 2 } { round { 1 1 } }

Return a list of vertices for a closed polygon (last vertex is equal to first vertex) that has the shape of a line segment.

  • pt1 list of {x y} coordinates of one end of the line segment.
  • pt2 list of {x y} coordinates of the other end of the line segment.
  • width width in pixel of the line.
  • round list of 2 boolean specifying which of the two ends should be drawn has a half disk.

gmlRectIntersect rect1 rect2

Return the (possibly empty) intersection rectangle between rect1 and rect2.

gmlTransfoTranslate transfo v

Returns the standard transformation resulting from the translation of transformation transfo by a 2 dimensional vector v. transfo and the result are in the form { translationX translationY rotation scaleX scaleY }

gmlRectShape2pt point1 point2

Return a list of vertices for a closed polygon (last vertex is equal to first vertex) that has the shape of a rectangle.

  • point1 coordinates of one end of a rectangle diagonal.
  • point2 coordinates of the other end of the rectangle diagonal.

gmlTransfoRotate transfo r

Returns the standard transformation resulting from the rotation of transformation transfo by an angle r (expressed in radians). transfo and the result are in the form { translationX translationY rotation scaleX scaleY }

gmlExpandRectRatio rect rx ry

Scale rect by (rx,ry) while keeping the same center

gmlGRItemTranslate canvas tag v

Translate of a 2D vector v all the items of the canvas canvas that have the tag tag.

gmlGRItemRotate canvas tag r

Rotate of an angle expressed in radian r all the items of the canvas canvas that have the tag tag.

gmlRectShape width height { anchor sw } { radius 0 } { roundCorners { 1 1 1 1 } }

Return a list of vertices for a closed polygon (last vertex is equal to first vertex) that has the shape of a rectangle with round corners.

  • width width (pixel) of the rectangle.
  • height height (pixel) of the rectangle.
  • anchor where is the coordinate system origin with respect to the rectangle, can be one of n ne e se s sw w nw c.
  • radius radius of the rounded corners.
  • roundCorners if radius is not 0, an list of four booleans specifying which corners are to be rounded, in the following order: { bottom-left bottom-right top-right top-left }

gmlRectUpper4_3 rect

Arrange for rect to have a 4/3 ratio by growing its size

gmlCircleShape radius { nbVertex 20 }

Return a list of vertices for a closed polygon (last vertex is equal to first vertex) that has a circle shape. nbVertex is the desired number of vertex (not counting the last one).

gmlDistance x1 y1 x2 y2

Returns the euclidian distance between two points of ccordinates x1 y1 and x2 y2.

gmlOutsidePolygon point vertices

Return true iff point is outside the polygon defined by vertices point is a 2-item list, vertices is list of 2-item lists; the polygon must not be closed (the first and last vertices mustn't be the same point).

gmlVectAdd v1 v2

Returns the vectors resulting from the addition of vectors v1 and v2. v1 and v2 must be of the same dimension.

gmlTransfoScale transfo s

Returns the standard transformation resulting from the scaling of transformation transfo by a 2 dimensional scaling vector s. transfo and the result are in the form { translationX translationY rotation scaleX scaleY }

gmlVectScale v s

Returns the vectors resulting from the multiplication of every components of vector v by the scalar s.