Kōtuku
  • Gallery
  • API
  • Wiki
  • GitHub
    • Audio
    • Config
    • Core
    • Display
    • Document
    • Font
    • HTTP
    • Network
    • Regex
    • SVG
    • Tiri
    • Vector
    • XML
    • XQuery
    • XRandR
      • Audio
      • MP3
      • Sound
      • File
      • MetaClass
      • Module
      • StorageDevice
      • Task
      • Thread
      • Time
      • Compression
      • CompressedStream
      • Config
      • LZMAStream
      • Script
      • Tiri
      • XML
      • XQuery
      • Controller
      • BlurFX
      • ColourFX
      • CompositeFX
      • ConvolveFX
      • DisplacementFX
      • FilterEffect
      • FloodFX
      • ImageFX
      • LightingFX
      • MergeFX
      • MorphologyFX
      • OffsetFX
      • RemapFX
      • SourceFX
      • TurbulenceFX
      • WaveFunctionFX
      • Scintilla
      • Bitmap
      • Clipboard
      • Display
      • Document
      • Font
      • Image
      • Pointer
      • Surface
      • SVG
      • ClientSocket
      • HTTP
      • NetClient
      • NetLookup
      • NetServer
      • NetSocket
      • Proxy
      • Gradient
      • GradientConic
      • GradientContour
      • GradientDiamond
      • GradientDiffusion
      • GradientDistal
      • GradientGouraud
      • GradientLinear
      • GradientMesh
      • GradientRadial
      • GradientVoronoi
      • Vector
      • VectorClip
      • VectorColour
      • VectorEllipse
      • VectorFilter
      • VectorGradient
      • VectorGroup
      • VectorImage
      • VectorPath
      • VectorPattern
      • VectorPolygon
      • VectorRectangle
      • VectorScene
      • VectorShape
      • VectorSpiral
      • VectorText
      • VectorTransition
      • VectorViewport
      • VectorWave
      • Linux Builds
      • Windows Builds
      • Customising Your Build
      • Kōtuku Objects
      • Kōtuku In Depth
      • Kōtuku Design Patterns
      • Coding With AI
      • Regex Manual
      • XML Comparisons
      • Tiri Reference Manual
      • Config API
      • Defer Syntax
      • GUI API
      • HTTP Server API
      • I/O API
      • JSON API
      • OAuth API
      • Options API
      • Proxy Server API
      • Tempus API
      • URL API
      • VFX API
      • Widgets
      • RIPL Reference Manual
      • Origo
      • Flute / Unit Testing
      • Tuku
      • Embedded Document Format
      • TDL Reference Manual
      • TDL Tools
      • Action Reference Manual
      • System Error Codes

VectorPolygon Class

Extends the Vector class with support for generating polygons.

The VectorPolygon class provides support for three different types of vector:

  1. Closed-point polygons consisting of at least 3 points.
  2. Open polygons consisting of at least 3 points (a 'polyline' in SVG).
  3. Single lines consisting of two points only (a 'line' in SVG).

To create a polyline, set the Closed field to false.

To create a line, set the Closed field to false and set only two points (X1,Y1) and (X2,Y2)

Structure

The VectorPolygon class consists of the following fields:

Access
NameTypeComment
 ClosedINTIf true, the polygon will be closed between the start and end points.

Set the Closed field to true to ensure that the polygon is closed between the start and end points. This behaviour is the default. If false, the polygon will not be closed, which results in the equivalent of the SVG polyline type.

 PathLengthINTCalibrates the user agent's distance-along-a-path calculations with that of the author.

The author's computation of the total length of the path, in user units. This value is used to calibrate the user agent's own distance-along-a-path calculations with that of the author. The user agent will scale all distance-along-a-path computations by the ratio of PathLength to the user agent's own computed value for total path length. This feature potentially affects calculations for text on a path, motion animation and various stroke operations.

 PointsSTRINGA series of (X,Y) coordinates that define the polygon.

The Points field can be set with a series of (X, Y) coordinates that will define the polygon's shape. A minimum of two numbered pairs will be required to define a valid polygon. Each point must be separated with either white-space or a comma.

 PointsArrayVectorPoint[]A series of numbered pairs that define the polygon.

The PointsArray field can be set with a VectorPoint array that defines the shape of a polygon. A minimum of two points is required for the shape to be valid. The VectorPoint structure consists of the following fields:

FieldTypeDescription
XDOUBLEThe X coordinate of this point.
YDOUBLEThe Y coordinate of this point.
XScaledUINT8TRUE if the X value is scaled to its viewport (between 0 and 1.0).
YScaledUINT8TRUE if the Y value is scaled to its viewport (between 0 and 1.0).
 X1UNITDefines the X coordinate of the first point.

This field defines the X coordinate of the first point of the polygon. It is recommended that this field is only used when creating a VectorPolygon that will be used to draw a single line.

By default the value will be treated as a fixed coordinate. Scaled values are supported if the value is a defined as a percentage.

 X2UNITDefines the X coordinate of the second point.

This field defines the X coordinate of the second point of the polygon. It is recommended that this field is only used when creating a VectorPolygon that will be used to draw a single line.

By default the value will be treated as a fixed coordinate. Scaled values are supported if the value is a defined as a percentage.

 Y1UNITDefines the Y coordinate of the first point.

This field defines the Y coordinate of the first point of the polygon. It is recommended that this field is only used when creating a VectorPolygon that will be used to draw a single line.

By default the value will be treated as a fixed coordinate. Scaled values are supported if the value is a defined as a percentage.

 Y2UNITDefines the Y coordinate of the second point.

This field defines the Y coordinate of the second point of the polygon. It is recommended that this field is only used when creating a VectorPolygon that will be used to draw a single line.

By default the value will be treated as a fixed coordinate. Scaled values are supported if the value is a defined as a percentage.

Actions

The following actions are currently supported:

MoveMoves a polygon to a new position.
ERR acMove(*Object, DOUBLE DeltaX, DOUBLE DeltaY, DOUBLE DeltaZ)
ParameterDescription
DeltaXThe number of units to move along the X axis.
DeltaYThe number of units to move along the Y axis.
DeltaZThe number of units to move along the Z axis.
MoveToPointMoves a polygon to a new central position.
ERR acMoveToPoint(*Object, DOUBLE X, DOUBLE Y, DOUBLE Z, MTF Flags)
ParameterDescription
XThe new X position to move the object to.
YThe new Y position to move the object to.
ZThe new Z position to move the object to.
FlagsSet the relevant MTF flag for each provided parameter.

This action will permanently modify the coordinates of a polygon so that they offset by the provided coordinate values.

The operation will abort if any of the points in the polygon are discovered to be relative coordinates.

ResizeResize the polygon by its width and height.
ERR acResize(*Object, DOUBLE Width, DOUBLE Height, DOUBLE Depth)
ParameterDescription
WidthThe new width of the object.
HeightThe new height of the object.
DepthThe new depth of the object.

This action will resize a polygon by adjusting all of its existing points. The points are rescaled to guarantee that they are within the provided dimensions.

If a Width and/or Height value of zero is passed, no scaling on the associated axis will occur.

VectorPolygon class documentation © Paul Manias © 2010-2026

VectorPoint Structure

Structure for the VectorPolygon PointsArray field.

FieldTypeDescription
XDOUBLEThe X coordinate of this point.
YDOUBLEThe Y coordinate of this point.
XScaledUINT8TRUE if the X value is scaled to its viewport (between 0 and 1.0).
YScaledUINT8TRUE if the Y value is scaled to its viewport (between 0 and 1.0).
VectorPolygon class documentation © Paul Manias © 2010-2026