Returns the radius of curvature of the Edge at the Vertex's location. If the Vertex is between two Edges, returns the radius of curvature with smaller absolute value. Negative curvature means the Edge is concave at that point.
radius of curvature of Edge at the Vertex, negative means concave
Sets the 'previous' Edge that this Vertex is connected to.
the 'previous' Edge that this Vertex is connected to.
if this Vertex was already connected to a previous Edge
Sets the 'next' Edge that this Vertex is connected to.
the 'next' Edge that this Vertex is connected to
if this Vertex was already connected to a next Edge
Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.
For an object whose main purpose is to represent another Printable object, it is
recommended to include the result of calling toStringShort
on that other object.
For example, calling toStringShort()
on a DisplayShape might return something like
this:
DisplayShape{polygon:Polygon{'chain3'}}
a minimal string representation of this object.
Generated using TypeDoc
A Vertex is a point on an Edge in a RigidBody, in body coordinates of the RigidBody. A Vertex can be at the end-point of the Edge, or at a mid-point of the Edge. An end-point Vertex is connected to two Edges which are called the 'previous' and 'next' Edges. A mid-point Vertex is connected to only a single Edge, which is considered to be both the 'previous' and 'next' Edge in that case.
See RigidBody, and Edge.
Decorated Mid-Point Vertexes
See also the section on Decorated Vertexes in the 2D Physics Engine Overview.
We add 'decorated mid-point Vertexes' along a curved edge to help with collision and contact detection.
In collision detection, we look at both the current and previous position of the bodies to guess how the bodies moved over the last time step. For a potential Vertex/Edge collision, we assume the Vertex moved along the straight line between its previous and current position, and look for the intersection of that line with the Edge.
For an Edge/Edge collision, when one of the Edges is curved, it is more difficult to detect collisions and contacts. For Edge/Edge collision testing we only use the current position of the Edges, instead of looking at how the Edges moved over time. There are cases where two rapidly moving curved edges can pass entirely thru each other in a single time step and so the Edge/Edge code will not detect the collision. The solution is to add Vertexes along the curved Edge, and rely on the regular Vertex/Edge collision checking.
We refer to these as 'mid-point' or 'decorated' Vertexes to distinguish them from the 'end-point' Vertexes at the end-points of line segments. See isEndPoint. The number of decorated Vertexes can be controlled by a spacing parameter when making a curved Edge.
What typically happens for a collision involving a curved Edge and another Edge is:
The mid-point Vertexes indicate there is a collision; the Edge/Edge tests might also indicate a collision.
After backing up and getting close to – but just before – the moment of collision, the Edge/Edge collision will have the smallest gap among all the detected contacts or collisions, and will therefore supersede any decorated Vertex/Edge collisions or contacts. The Edge/Edge collision gives better accuracy.