Abstract
Protected
body_the RigidBody that this edge is a part of
Protected
centroidthe maximum distance from centroid to any point on this edge
Protected
centroid_the 'center' of this edge, an arbitrary point selected to minimize the centroid radius of this edge
Private
centroid_The centroid of this edge in world coords. For performance reasons this is cached. See forgetPosition.
Protected
index_index of this edge in the body's list of edges
Protected
v1_the previous vertex, in body coords; matches the next (second) vertex of the previous edge
Protected
v2_the next vertex, in body coords
Abstract
addAbstract
chordReturns the maximum distance between this Edge and any chord between Vertexes on this Edge (including decorated mid-point Vertexes). A chord is the straight line between two adjacent Vertexes.
Here is a picture of a curved Edge, the chord between two Vertexes, V1, V2, and the chord error is the maximum distance between the chord and curved Edge.
Note that having more decorated mid-point Vertexes results in a smaller chord error, because the chords are closer to the curve.
See Vertex for more about decorated mid-point Vertexes
the maximum distance between this Edge and a chord between any Vertexes on this Edge
Abstract
distanceReturns smallest distance between this Edge and the given Edge. Returns NaN
in
cases where the calculation can't be done. One of the Edges must be curved.
TO DO distanceToEdge is not used currently... delete it? or use it in places like
CircleStraight.testCollision
and CircleCircle.testCollision
?
the Edge to measure distance to
smallest distance between this Edge and the given Edge, or NaN
when the calculation cannot be done
if both Edges are StraightEdges.
Abstract
distanceReturns distance from the given point (in body coordinates) to the extended line of this Edge, where the extensions continue beyond the endpoints of this Edge. For a CircularEdge the extended line is taken to be the full circle. Positive distance means the point is outside of this Edge, negative means inside.
the point to find distance from, in body coords
distance from the given point to the extended line of this Edge
Abstract
distanceReturns signed distance of the given point (in body coordinates) to this Edge along a line that is normal to this Edge, or infinity if beyond an endpoint of this Edge. Distance is positive if it is on the side of the line that the normal points towards, otherwise negative.
the point to find distance from, in body coords
signed distance from the given point to this Edge (positive if point is on side the normal points towards) or infinity if beyond the endpoint of this Edge
Abstract
findReturns a RigidBodyCollision representing the contact point if the given Vertex is close to this Edge. Closeness is specified by the given distance tolerance. Note that this does not consider velocity tests for a contact. If the point does not lie along any normal to this Edge, then it is not close; this occurs when the point is past the endpoints of this Edge.
If the point is near, then the returned RigidBodyCollision will have the following information set:
body
is set to the RigidBody of the VertexnormalBody
is set to the RigidBody of this Edger2
is based on current position of this Edge's RigidBodyAdditionally, if this Edge is curved, the following are also set:
ballNormal, radius2, u2
.
a RigidBodyCollision representing the contact point,
or null
if not close enough.
Abstract
getReturns the center of the circle to use for proximity testing, in body coordinates.
A circle centered at this centroid with radius getCentroidRadius()
should encompass
this Edge. See getCentroidRadius and getCentroidWorld.
the center of the circle to use for proximity testing, in body coordinates
Returns the radius of the circle to use for proximity testing. A circle centered at
getCentroidWorld()
with this radius should encompass this Edge. See
setCentroidRadius, getCentroidRadius and getCentroidWorld.
the radius of the circle to use for proximity testing
Returns the center of the circle to use for proximity testing, in world coordinates.
A circle centered at this point with radius getCentroidRadius()
should encompass
this Edge. See getCentroidRadius and getCentroidBody.
the center of the circle to use for proximity testing, in world coordinates
Abstract
getAbstract
getReturns radius of curvature at the given point on this Edge. Radius of curvature is the radius of a circle that would give equivalent curvature at a given point on an Edge. Negative curvature means the Edge is concave at that point.
For a circle, every point on the circle has the same center and radius of curvature. But for any other curve (an oval for instance), each point on the edge can have a different center and radius of curvature.
the point on this Edge, in body coordinates
the radius of curvature; negative means concave; returns positive infinity if this is a straight edge
if the point is not close to this Edge
Abstract
getAbstract
getReturns unit normal vector in body coordinates, at the given body coordinates point. Normal points outwards from the RigidBody. TO DO what if the point is not on this Edge?
the point on this Edge in body coordinates
the outwards pointing unit normal vector at the given point, in body coordinates
Abstract
getFinds the nearest point on this Edge to the given point, returns that nearest point
and the unit normal vector there. Returns null
if the given point lies beyond the end
point of this Edge, meaning that there is no perpendicular line to this Edge passing
thru the given point.
a point near this Edge, in body coordinates
a pair of Vectors: the nearest point
on this Edge, and the unit normal vector at that point both in body coords; or
null
if there is no nearest point on this Edge.
Abstract
getAbstract
getAbstract
highlightAbstract
improveUpdates the EdgeEdgeCollision to have more accurate information based on current positions and velocities of the RigidBodys.
the EdgeEdgeCollision to update
the other Edge involved in the collision
Abstract
intersectionReturns points on this Edge intersecting the straight line segment between the two
given points (in body coordinates), or null
if there is no intersection. There can be
more than one point of intersection.
array of intersection points, in body
coords, or null
if no intersection.
Rough proximity test that returns true
if an intersection is possible between this
Edge and the specified Edge. This is intended to do a quick rough test to eliminate
obvious cases where no intersection is possible. Swellage
is a fudge factor which is
added to the max radius of the Edges, to make the test easier to succeed.
the other Edge
a fudge factor which is added to the max radius of the Edges
whether an intersection between the Edges is possible
Abstract
isAbstract
maxReturns the maximum distance from the given point (in body coordinates) to any point on this Edge.
a point in body coordinates
the maximum distance from the given point (in body coordinates) to any point on this Edge
Returns the point offset in the direction of this Edge's normal. The normal is taken at the point on this Edge that is closest to the given point. The point is given and returned in body coordinates. Note that the returned point might be closer to this Edge when the starting point is on the inside of the RigidBody, because the normal points outwards.
the point near this Edge, in body coordinates
the distance to move the point
the point offset in the direction of this Edge's normal, in body coordinates
Sets the radius of the circle to use for proximity testing. A circle
centered at getCentroidWorld()
with this radius should encompass this Edge.
See getCentroidRadius, getCentroidBody and getCentroidWorld.
the radius of the circle to use for proximity testing
Sets the finish Vertex of this Edge. Should match the start Vertex of the next Edge in the RigidBody.
the finish Vertex of this Edge
Abstract
testIf there is a collision between this Edge and the given Edge, adds a RigidBodyCollision to the list. This ignores collisions with Vertexes.
list of collisions to add to
the other Edge
current simulation time
Generated using TypeDoc
Abstract base class for Edge.
TO DO rename v1, v2 to be vertex1, vertex2
TO DO probably this should be an interface, not an abstract class???
TO DO distanceToLine: why not take the distance to end point of the edge when the point is beyond the edge?
TO DO An Edge doesn't really need to know the RigidBody it is part of. There are 3 usages of body: 1) for coordinate transformation (bodyToWorld etc.). This could be provided via an interface that defines those methods. 2) during construction, to add the Edge and its Vertexes to the Body 3) for creating a Collision or Contact. Number (1) can be provided via an interface that defines those methods. Numbers (2) and (3) could be deferred to / handled by the RigidBody itself. So: we could make Edge know far less about RigidBody, which would be a good thing in terms of object-oriented design principles.