HalfEdge object

 < Day Day Up > 

Availability

Flash MX 2004.

Description

The HalfEdge object is the directed side of the edge of a Shape object. An edge has two half edges. You can transverse the contours of a shape by "walking around" these half edges. For example, starting from a half edge, you can trace all the half edges around a contour of a shape, and return to the original half edge.

Half edges are ordered. One half edge represents one side of the edge; the other half edge represents the other side.

Method summary for the HalfEdge object

The following methods are available for the HalfEdge object:

Method

Description

halfEdge.getEdge()

Gets the Edge object for the HalfEdge object.

halfEdge.getNext()

Gets the next half edge on the current contour.

halfEdge.getOppositeHalfEdge()

Gets the HalfEdge object on the other side of the edge.

halfEdge.getPrev()

Gets the preceding HalfEdge object on the current contour.

halfEdge.getVertex()

Gets the Vertex object at the head of the HalfEdge object.


Property summary for the HalfEdge object

The following properties are available for the HalfEdge object:

Property

Description

halfEdge.id

Read-only; a unique integer identifier for the HalfEdge object.

halfEdge.index

 


halfEdge.getEdge()

Availability

Flash MX 2004.

Usage

halfEdge.getEdge()

Parameters

None.

Returns

An Edge object.

Description

Method; gets the Edge object for the HalfEdge object. See Edge object.

Example

The following example illustrates getting an edge and a half edge for the specified shape.

var shape = fl.getDocumentDOM().selection[0]; var hEdge = shape.edges[0].getHalfEdge(0); var edge = hEdge.getEdge();

halfEdge.getNext()

Availability

Flash MX 2004.

Usage

halfEdge.getNext()

Parameters

None.

Returns

A HalfEdge object.

Description

Method; gets the next half edge on the current contour.

NOTE

Although half edges have a direction and a sequence order, edges do not.


Example

The following example stores the next half edge of the specified contour in the nextHalfEdge variable:

var shape = fl.getDocumentDOM().selection[0]; var hEdge = shape.edges[0].getHalfEdge( 0 ); var nextHalfEdge = hEdge.getNext();

halfEdge.getOppositeHalfEdge()

Availability

Flash MX 2004.

Usage

halfEdge.getOppositeHalfEdge()

Parameters

None.

Returns

A HalfEdge object.

Description

Method; gets the HalfEdge object on the other side of the edge.

Example

The following example stores the half edge opposite hEdge in the otherHalfEdge variable:

var shape = fl.getDocumentDOM().selection[0]; var hEdge = shape.edges[0].getHalfEdge(0); var otherHalfEdge = hEdge.getOppositeHalfEdge();

halfEdge.getPrev()

Availability

Flash MX 2004.

Usage

halfEdge.getPrev()

Parameters

None.

Returns

A HalfEdge object.

Description

Method; gets the preceding HalfEdge object on the current contour.

NOTE

Although half edges have a direction and a sequence order, edges do not.


Example

The following example stores the previous half edge of the specified contour in the prevHalfEdge variable:

var shape = fl.getDocumentDOM().selection[0]; var hEdge = shape.edges[0].getHalfEdge( 0 ); var prevHalfEdge = hEdge.getPrev();

halfEdge.getVertex()

Availability

Flash MX 2004.

Usage

halfEdge.getVertex()

Parameters

None.

Returns

A Vertex object.

Description

Method; gets the Vertex object at the head of the HalfEdge object. See Vertex object.

Example

The following example stores the Vertex object at the head of hEdge in the vertex variable:

var shape = fl.getDocumentDOM().selection[0]; var edge = shape.edges[0]; var hEdge = edge.getHalfEdge(0); var vertex = hEdge.getVertex();

halfEdge.id

Availability

Flash MX 2004.

Usage

halfEdge.id

Description

Read-only property; a unique integer identifier for the HalfEdge object.

Example

The following example displays a unique identifier for the specified half edge in the Output panel:

var shape = fl.getDocumentDOM().selection[0]; alert(shape.contours[0].getHalfEdge().id);

halfEdge.index

Availability

Flash MX 2004.

Usage

halfEdge.index

Description

Read-only property; an integer with a value of 0 or 1 that specifies the index for this HalfEdge object in the parent edge.

Example

The following example displays the index value for the specified half edge in the Output panel:

var shape = fl.getDocumentDOM().selection[0]; var hEdge = shape.edges[0].getHalfEdge(0); var heIndex = hEdge.index;

     < Day Day Up > 


    Developing Extensions for Macromedia Flash 8
    Developing Extensions for Macromedia Flash 8
    ISBN: 032139416X
    EAN: 2147483647
    Year: 2005
    Pages: 81

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net