Home Reference Source
public class | source

HalfEdge

Extends:

three~EventDispatcher → HalfEdge

Half Edges are created by Room.

Once rooms have been identified, Half Edges are created for each interior wall.

A wall can have two half edges if it is visible from both sides.

Constructor Summary

Public Constructor
public

constructor(room: Room, wall: Wall, front: boolean)

Constructs a half edge.

Member Summary

Public Members
public

center: Vector3

The center of this half edge

public

The exterior transformation matrix that contains the homogeneous transformation of the plane based on the two corner positions of the wall

public

Is this is the front edge or the back edge

public

The height of a wall

public

The interior transformation matrix that contains the homogeneous transformation of the plane based on the two corner positions of the wall

public

The inverse of the exterior transformation matrix that contains the homogeneous transformation of the plane based on the two corner positions of the wall

public

The inverse of the interior transformation matrix that contains the homogeneous transformation of the plane based on the two corner positions of the wall

public

max: Vector3

The maximum point in space calculated from the bounds

public

min: Vector3

The minimum point in space calculated from the bounds

public

Reference to the next halfedge instance connected to this

public

The offset to maintain for the front and back walls from the midline of a wall

public

plane: Mesh

The plane mesh that will be used for checking intersections of wall items

public

Reference to the previous halfedge instance connected to this

public

This is an array of callbacks to be call when redraw happens

public

Reference to a Room instance

public

Reference to a Wall instance

Method Summary

Public Methods
public

computeTransforms(transform: Matrix4, invTransform: Matrix4, start: Vector2, end: Vector2)

Calculate the transformation matrix for the edge (front/back) baesd on the parameters.

public

Get the corners of the half edge.

public

Emit the redraw event

public

Gets the distance from specified point.

public

exteriorCenter(): Vector2

Return the 2D exterior location that is at the center/middle.

public

Return the exterior distance of the exterior wall

public

exteriorEnd(): Vector2

Return the 2D exterior location that is at the end.

public

exteriorStart(): Vector2

Return the 2D exterior location that is at the start.

public

This generates the invisible planes in the scene that are used for interesection testing for the wall items

public

Get the ending corner of the wall this instance represents

public

If this is the front edge then return the back edge.

public

Get the starting corner of the wall this instance represents

public

Two separate textures are used for the walls.

public

halfAngleVector(v1: Vector2, v1: Vector2): Object

Gets CCW angle from v1 to v2

public

interiorCenter(): Vector2

Return the 2D interior location that is at the center/middle.

public

Return the interior distance of the interior wall

public

interiorEnd(): Vector2

Return the 2D interior location that is at the end.

public

interiorStart(): Vector2

Return the 2D interior location that is at the start.

public

setTexture(textureUrl: String, textureStretch: boolean, textureScale: Number)

Set a Texture to the wall.

public

transformCorner(corner: Corner): Vector3

Transform the Corner instance to a Vector3 instance using the x and y position returned as x and z

Public Constructors

public constructor(room: Room, wall: Wall, front: boolean) source

Constructs a half edge.

Params:

NameTypeAttributeDescription
room Room

The associated room. Instance of Room

wall Wall

The corresponding wall. Instance of Wall

front boolean

True if front side. Boolean value

Public Members

public center: Vector3 source

The center of this half edge

Properties:

NameTypeAttributeDescription
center Vector3

The center of this half edge

See:

public exteriorTransform: Matrix4 source

The exterior transformation matrix that contains the homogeneous transformation of the plane based on the two corner positions of the wall

Properties:

NameTypeAttributeDescription
exteriorTransform Matrix4

The exterior transformation matrix that contains the homogeneous transformation of the plane based on the two corner positions of the wall

See:

public front: boolean source

Is this is the front edge or the back edge

Properties:

NameTypeAttributeDescription
front boolean

Is this is the front edge or the back edge

public height: Number source

The height of a wall

Properties:

NameTypeAttributeDescription
height Number

The height of a wall

public interiorTransform: Matrix4 source

The interior transformation matrix that contains the homogeneous transformation of the plane based on the two corner positions of the wall

Properties:

NameTypeAttributeDescription
interiorTransform Matrix4

The interior transformation matrix that contains the homogeneous transformation of the plane based on the two corner positions of the wall

See:

public invExteriorTransform: Matrix4 source

The inverse of the exterior transformation matrix that contains the homogeneous transformation of the plane based on the two corner positions of the wall

Properties:

NameTypeAttributeDescription
invExteriorTransform Matrix4

The inverse of the exterior transformation matrix that contains the homogeneous transformation of the plane based on the two corner positions of the wall

See:

public invInteriorTransform: Matrix4 source

The inverse of the interior transformation matrix that contains the homogeneous transformation of the plane based on the two corner positions of the wall

Properties:

NameTypeAttributeDescription
invInteriorTransform Matrix4

The inverse of the interior transformation matrix that contains the homogeneous transformation of the plane based on the two corner positions of the wall

See:

public max: Vector3 source

The maximum point in space calculated from the bounds

Properties:

NameTypeAttributeDescription
max Vector3

The maximum point in space calculated from the bounds

See:

public min: Vector3 source

The minimum point in space calculated from the bounds

Properties:

NameTypeAttributeDescription
min Vector3

The minimum point in space calculated from the bounds

See:

public next: HalfEdge source

Reference to the next halfedge instance connected to this

Properties:

NameTypeAttributeDescription
next HalfEdge

Reference to the next halfedge instance connected to this

public offset: Number source

The offset to maintain for the front and back walls from the midline of a wall

Properties:

NameTypeAttributeDescription
offset Number

The offset to maintain for the front and back walls from the midline of a wall

public plane: Mesh source

The plane mesh that will be used for checking intersections of wall items

Properties:

NameTypeAttributeDescription
plane Mesh

The plane mesh that will be used for checking intersections of wall items

See:

public prev: HalfEdge source

Reference to the previous halfedge instance connected to this

Properties:

NameTypeAttributeDescription
prev HalfEdge

Reference to the previous halfedge instance connected to this

public redrawCallbacks: * source

This is an array of callbacks to be call when redraw happens

public room: Room source

Reference to a Room instance

Properties:

NameTypeAttributeDescription
room Room

Reference to a Room instance

public wall: Wall source

Reference to a Wall instance

Properties:

NameTypeAttributeDescription
room Wall

Reference to a Wall instance

Public Methods

public computeTransforms(transform: Matrix4, invTransform: Matrix4, start: Vector2, end: Vector2) source

Calculate the transformation matrix for the edge (front/back) baesd on the parameters.

Params:

NameTypeAttributeDescription
transform Matrix4

The matrix reference in which the transformation is stored

invTransform Matrix4

The inverse of the transform that is stored in the invTransform

start Vector2

The starting point location

end Vector2

The ending point location

See:

public corners(): Corner[] source

Get the corners of the half edge.

Return:

Corner[]

An array of x,y pairs.

public dispatchRedrawEvent() source

Emit the redraw event

Emit:

EVENT_REDRAW

public distanceTo(x: Number, y: Number): Number source

Gets the distance from specified point.

Params:

NameTypeAttributeDescription
x Number

X coordinate of the point.

y Number

Y coordinate of the point.

Return:

Number

The distance.

public exteriorCenter(): Vector2 source

Return the 2D exterior location that is at the center/middle.

Return:

Vector2

Return an object with attributes x, y

See:

public exteriorDistance(): Number source

Return the exterior distance of the exterior wall

Return:

Number

The distance

public exteriorEnd(): Vector2 source

Return the 2D exterior location that is at the end.

Return:

Vector2

Return an object with attributes x, y

See:

public exteriorStart(): Vector2 source

Return the 2D exterior location that is at the start.

Return:

Vector2

Return an object with attributes x, y

See:

public generatePlane() source

This generates the invisible planes in the scene that are used for interesection testing for the wall items

public getEnd(): Corner source

Get the ending corner of the wall this instance represents

Return:

Corner

The ending corner

public getOppositeEdge(): HalfEdge source

If this is the front edge then return the back edge. For example in a wall there are two halfedges, i.e one for front and one back. Based on which side this halfedge lies return the opposite HalfEdge

Return:

HalfEdge

The other HalfEdge

public getStart(): Corner source

Get the starting corner of the wall this instance represents

Return:

Corner

The starting corner

public getTexture(): Object source

Two separate textures are used for the walls. Based on which side of the wall this {HalfEdge} refers the texture is returned

Return:

Object

front/back Two separate textures are used for the walls. Based on which side of the wall this HalfEdge refers the texture is returned

public halfAngleVector(v1: Vector2, v1: Vector2): Object source

Gets CCW angle from v1 to v2

Params:

NameTypeAttributeDescription
v1 Vector2

The point a

v1 Vector2

The point b

Return:

Object

contains keys x and y with number representing the halfAngles

public interiorCenter(): Vector2 source

Return the 2D interior location that is at the center/middle.

Return:

Vector2

Return an object with attributes x, y

See:

public interiorDistance(): Number source

Return the interior distance of the interior wall

Return:

Number

The distance

public interiorEnd(): Vector2 source

Return the 2D interior location that is at the end.

Return:

Vector2

Return an object with attributes x, y

See:

public interiorStart(): Vector2 source

Return the 2D interior location that is at the start.

Return:

Vector2

Return an object with attributes x, y

See:

public setTexture(textureUrl: String, textureStretch: boolean, textureScale: Number) source

Set a Texture to the wall. Based on the edge side as front or back the texture is applied appropriately to the wall

Params:

NameTypeAttributeDescription
textureUrl String

The path to the texture image

textureStretch boolean

Can the texture stretch? If not it will be repeated

textureScale Number

The scale value using which the number of repetitions of the texture image is calculated

Emit:

EVENT_REDRAW

public transformCorner(corner: Corner): Vector3 source

Transform the Corner instance to a Vector3 instance using the x and y position returned as x and z

Params:

NameTypeAttributeDescription
corner Corner

Return:

Vector3

See: