PackageBox2D.Collision.Shapes
Classpublic class b2EdgeShape
Inheritanceb2EdgeShape Inheritance b2Shape
Sourceb2EdgeShape.as

An edge shape.

See also

b2EdgeChainDef


Public Methods
 MethodDefined by
  
ComputeAABB(aabb:b2AABB, transform:b2XForm):void
Given a transform, compute the associated axis aligned bounding box for this shape.
b2EdgeShape
  
ComputeMass(massData:b2MassData):void
Compute the mass properties of this shape using its dimensions and density.
b2EdgeShape
  
ComputeSweptAABB(aabb:b2AABB, transform1:b2XForm, transform2:b2XForm):void
Given two transforms, compute the associated swept axis aligned bounding box for this shape.
b2EdgeShape
  
Corner1IsConvex():Boolean
Returns true if the first corner of this edge bends towards the solid side.
b2EdgeShape
  
Corner2IsConvex():Boolean
Returns true if the second corner of this edge bends towards the solid side.
b2EdgeShape
 Inherited
Get the parent body of this shape.
b2Shape
  
Get a core vertex in local coordinates.
b2EdgeShape
  
Get a core vertex in local coordinates.
b2EdgeShape
  
Returns a unit vector halfway between m_direction and m_prevEdge.m_direction.
b2EdgeShape
  
Returns a unit vector halfway between m_direction and m_nextEdge.m_direction.
b2EdgeShape
  
Get a parallel unit vector, pointing from vertex1 to vertex2.
b2EdgeShape
 Inherited
Get the contact filtering data.
b2Shape
  
Get the first vertex and apply the supplied transform.
b2EdgeShape
 Inherited
GetFriction():Number
Get the coefficient of friction.
b2Shape
  
GetLength():Number
Get the distance from vertex1 to vertex2.
b2EdgeShape
 Inherited
Get the next shape in the parent body's shape list.
b2Shape
  
Get the next edge in the chain.
b2EdgeShape
  
Get a perpendicular unit vector, pointing from the solid side to the empty side.
b2EdgeShape
  
Get the previous edge in the chain.
b2EdgeShape
 Inherited
GetRestitution():Number
Get the coefficient of restitution.
b2Shape
 Inherited
GetSweepRadius():Number
Get the maximum radius about the parent body's center of mass.
b2Shape
 Inherited
GetType():int
Get the type of this shape.
b2Shape
 Inherited
Get the user data that was assigned in the shape definition.
b2Shape
  
Get the local position of vertex1 in parent body.
b2EdgeShape
  
Get the local position of vertex2 in parent body.
b2EdgeShape
 Inherited
IsSensor():Boolean
Is this shape a sensor (non-solid)?
b2Shape
 Inherited
Set the contact filtering data.
b2Shape
 Inherited
SetFriction(friction:Number):void
Set the coefficient of friction.
b2Shape
 Inherited
SetRestitution(restitution:Number):void
Set the coefficient of restitution.
b2Shape
 Inherited
SetUserData(data:*):void
Set the user data.
b2Shape
  
Support(xf:b2XForm, dX:Number, dY:Number):b2Vec2
Get the support point in the given world direction.
b2EdgeShape
  
TestPoint(transform:b2XForm, p:b2Vec2):Boolean
Returns false.
b2EdgeShape
  
TestSegment(transform:b2XForm, lambda:Array, normal:b2Vec2, segment:b2Segment, maxLambda:Number):int
Perform a ray cast against this shape.
b2EdgeShape
Public Constants
 ConstantDefined by
 Inheritede_hitCollide : int = 1
[static] Return value for TestSegment indicating a hit.
b2Shape
 Inheritede_missCollide : int = 0
[static] Return value for TestSegment indicating a miss.
b2Shape
 Inheritede_startsInsideCollide : int = -1
[static] Return value for TestSegment indicating that the segment starting point, p1, is already inside the shape.
b2Shape
Method detail
ComputeAABB()method
public override function ComputeAABB(aabb:b2AABB, transform:b2XForm):void

Given a transform, compute the associated axis aligned bounding box for this shape.

Parameters
aabb:b2AABB — returns the axis aligned box.
 
transform:b2XForm — the world transform of the shape.
ComputeMass()method 
public override function ComputeMass(massData:b2MassData):void

Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin, not the centroid.

Parameters
massData:b2MassData — returns the mass data for this shape.
ComputeSweptAABB()method 
public override function ComputeSweptAABB(aabb:b2AABB, transform1:b2XForm, transform2:b2XForm):void

Given two transforms, compute the associated swept axis aligned bounding box for this shape.

Parameters
aabb:b2AABB — returns the axis aligned box.
 
transform1:b2XForm — the starting shape world transform.
 
transform2:b2XForm — the ending shape world transform.
Corner1IsConvex()method 
public function Corner1IsConvex():Boolean

Returns true if the first corner of this edge bends towards the solid side.

Returns
Boolean
Corner2IsConvex()method 
public function Corner2IsConvex():Boolean

Returns true if the second corner of this edge bends towards the solid side.

Returns
Boolean
GetCoreVertex1()method 
public function GetCoreVertex1():b2Vec2

Get a core vertex in local coordinates. These vertices represent a smaller edge that is used for time of impact computations.

Returns
b2Vec2
GetCoreVertex2()method 
public function GetCoreVertex2():b2Vec2

Get a core vertex in local coordinates. These vertices represent a smaller edge that is used for time of impact computations.

Returns
b2Vec2
GetCorner1Vector()method 
public function GetCorner1Vector():b2Vec2

Returns a unit vector halfway between m_direction and m_prevEdge.m_direction.

Returns
b2Vec2
GetCorner2Vector()method 
public function GetCorner2Vector():b2Vec2

Returns a unit vector halfway between m_direction and m_nextEdge.m_direction.

Returns
b2Vec2
GetDirectionVector()method 
public function GetDirectionVector():b2Vec2

Get a parallel unit vector, pointing from vertex1 to vertex2.

Returns
b2Vec2
GetFirstVertex()method 
public function GetFirstVertex(xf:b2XForm):b2Vec2

Get the first vertex and apply the supplied transform.

Parameters
xf:b2XForm

Returns
b2Vec2
GetLength()method 
public function GetLength():Number

Get the distance from vertex1 to vertex2.

Returns
Number
GetNextEdge()method 
public function GetNextEdge():b2EdgeShape

Get the next edge in the chain.

Returns
b2EdgeShape
GetNormalVector()method 
public function GetNormalVector():b2Vec2

Get a perpendicular unit vector, pointing from the solid side to the empty side.

Returns
b2Vec2
GetPrevEdge()method 
public function GetPrevEdge():b2EdgeShape

Get the previous edge in the chain.

Returns
b2EdgeShape
GetVertex1()method 
public function GetVertex1():b2Vec2

Get the local position of vertex1 in parent body.

Returns
b2Vec2
GetVertex2()method 
public function GetVertex2():b2Vec2

Get the local position of vertex2 in parent body.

Returns
b2Vec2
Support()method 
public function Support(xf:b2XForm, dX:Number, dY:Number):b2Vec2

Get the support point in the given world direction. Use the supplied transform.

Parameters
xf:b2XForm
 
dX:Number
 
dY:Number

Returns
b2Vec2
TestPoint()method 
public override function TestPoint(transform:b2XForm, p:b2Vec2):Boolean

Returns false. Edges cannot contain points.

Parameters
transform:b2XForm
 
p:b2Vec2

Returns
Boolean
TestSegment()method 
public override function TestSegment(transform:b2XForm, lambda:Array, normal:b2Vec2, segment:b2Segment, maxLambda:Number):int

Perform a ray cast against this shape.

Parameters
transform:b2XForm — the shape world transform.
 
lambda:Array — returns the hit fraction. You can use this to compute the contact point: p = (1 - lambda) segment.p1 + lambda segment.p2. lambda should be an array with one member. After calling TestSegment, you can retrieve the output value with lambda[0].
 
normal:b2Vec2 — returns the normal at the contact point. If there is no intersection, the normal is not set.
 
segment:b2Segment — defines the begin and end point of the ray cast.
 
maxLambda:Number — a number typically in the range [0,1].

Returns
int — b2Shape.e_hitCollide if there was an intersection, b2Shape.e_startsInsideCollide if the point is inside and b2Shape.e_missCollide otherwise.