getVertex()

Purpose

Find the screen position of a vertex (point) in a shape

Description

Returns a vector describing the screen position of a desired vertex in a shape drawn with drawShape()

Syntax

position = getVertex( shape, vertex )

Arguments

shape Handle which stores the shape in question

position Vector describing the screen x and y position of the desired vertex

vertex Float index of the desired vertex (begins at 0, clockwise)

Example

gw = gwidth()
gh = gheight()

shape = createBox( gw / 2, gh / 2, gw / 2, gh / 2 )
coords = []

for i = 0 to 4 loop
    col = {random(1.0), random(1.0), random(1.0), 1}
    setVertexColour( shape, i, col )
    coords[i] = getVertex( shape, i )
repeat

loop
    clear()
    for i = 0 to len( coords ) loop
        printAt( 0, i, "Vertex ", i, " Screen Coordinate: ", coords[i] )
        if i == 0 or i == 3 then
            drawText( coords[i].x - 40, coords[i].y - 20, 40, white, i )
        else
            drawText( coords[i].x + 20, coords[i].y - 20, 40, white, i )
        endif
    repeat
    drawShape( shape )
    update()
repeat

Associated Commands

copyShape(), createBox(), createCircle(), createCurve(), createLine(), createLineStrip(), createPoly(), createStar(), createTriangle(), deleteShape(), drawShape(), getShapeBounds(), getShapeLocation(), getShapeRotation(), getShapeScale(), getShapeTint(), getVertexColour(), getVertexLineColour(), getVertexLineThickness(), joinShapes(), moveShape(), numVerts(), rotateShape(), scaleShape(), setShapeColour(), setShapeLineStyle(), setShapeRotation(), setShapeScale(), setShapeScaleModeLocal(), setShapeTint(), setVertex(), setVertexColour(), setVertexLineStyle()