Ctrl+K

LineTools

Declaration

public static class tainicom.Aether.Physics2D.Common.LineTools

Collection of helper methods for misc collisions. Does float tolerance and line collisions with lines and AABBs.

Methods

DistanceBetweenPointAndLineSegment static

float DistanceBetweenPointAndLineSegment(ref Vector2 point, ref Vector2 start, ref Vector2 end)

Parameters:

Name Type Description
point ref Strawberry.Math.Vector2
start ref Strawberry.Math.Vector2
end ref Strawberry.Math.Vector2

LineIntersect2 static

Check if the lines a0->a1 and b0->b1 cross. If they do, intersectionPoint will be filled with the point of crossing. Grazing lines should not return true.

bool LineIntersect2(ref Vector2 a0, ref Vector2 a1, ref Vector2 b0, ref Vector2 b1, out Vector2 intersectionPoint)

Parameters:

Name Type Description
a0 ref Strawberry.Math.Vector2
a1 ref Strawberry.Math.Vector2
b0 ref Strawberry.Math.Vector2
b1 ref Strawberry.Math.Vector2
intersectionPoint out Strawberry.Math.Vector2

LineIntersect static

Vector2 LineIntersect(Vector2 p1, Vector2 p2, Vector2 q1, Vector2 q2)

Parameters:

Name Type Description
p1 Strawberry.Math.Vector2
p2 Strawberry.Math.Vector2
q1 Strawberry.Math.Vector2
q2 Strawberry.Math.Vector2

LineIntersect static

This method detects if two line segments (or lines) intersect, and, if so, the point of intersection. Use the firstIsSegment and secondIsSegment parameters to set whether the intersection point must be on the first and second line segments. Setting these both to true means you are doing a line-segment to line-segment intersection. Setting one of them to true means you are doing a line to line-segment intersection test, and so on. Note: If two line segments are coincident, then no intersection is detected (there are actually infinite intersection points). Author: Jeremy Bell

bool LineIntersect(ref Vector2 point1, ref Vector2 point2, ref Vector2 point3, ref Vector2 point4, bool firstIsSegment, bool secondIsSegment, out Vector2 point)

Parameters:

Name Type Description
point1 ref Strawberry.Math.Vector2 The first point of the first line segment.
point2 ref Strawberry.Math.Vector2 The second point of the first line segment.
point3 ref Strawberry.Math.Vector2 The first point of the second line segment.
point4 ref Strawberry.Math.Vector2 The second point of the second line segment.
firstIsSegment System.Boolean Set this to true to require that the intersection point be on the first line segment.
secondIsSegment System.Boolean Set this to true to require that the intersection point be on the second line segment.
point out Strawberry.Math.Vector2 This is set to the intersection point if an intersection is detected.

Returns: True if an intersection is detected, false otherwise.

LineIntersect static

This method detects if two line segments (or lines) intersect, and, if so, the point of intersection. Use the firstIsSegment and secondIsSegment parameters to set whether the intersection point must be on the first and second line segments. Setting these both to true means you are doing a line-segment to line-segment intersection. Setting one of them to true means you are doing a line to line-segment intersection test, and so on. Note: If two line segments are coincident, then no intersection is detected (there are actually infinite intersection points). Author: Jeremy Bell

bool LineIntersect(Vector2 point1, Vector2 point2, Vector2 point3, Vector2 point4, bool firstIsSegment, bool secondIsSegment, out Vector2 intersectionPoint)

Parameters:

Name Type Description
point1 Strawberry.Math.Vector2 The first point of the first line segment.
point2 Strawberry.Math.Vector2 The second point of the first line segment.
point3 Strawberry.Math.Vector2 The first point of the second line segment.
point4 Strawberry.Math.Vector2 The second point of the second line segment.
firstIsSegment System.Boolean Set this to true to require that the intersection point be on the first line segment.
secondIsSegment System.Boolean Set this to true to require that the intersection point be on the second line segment.
intersectionPoint out Strawberry.Math.Vector2 This is set to the intersection point if an intersection is detected.

Returns: True if an intersection is detected, false otherwise.

LineIntersect static

This method detects if two line segments intersect, and, if so, the point of intersection. Note: If two line segments are coincident, then no intersection is detected (there are actually infinite intersection points).

bool LineIntersect(ref Vector2 point1, ref Vector2 point2, ref Vector2 point3, ref Vector2 point4, out Vector2 intersectionPoint)

Parameters:

Name Type Description
point1 ref Strawberry.Math.Vector2 The first point of the first line segment.
point2 ref Strawberry.Math.Vector2 The second point of the first line segment.
point3 ref Strawberry.Math.Vector2 The first point of the second line segment.
point4 ref Strawberry.Math.Vector2 The second point of the second line segment.
intersectionPoint out Strawberry.Math.Vector2 This is set to the intersection point if an intersection is detected.

Returns: True if an intersection is detected, false otherwise.

LineIntersect static

This method detects if two line segments intersect, and, if so, the point of intersection. Note: If two line segments are coincident, then no intersection is detected (there are actually infinite intersection points).

bool LineIntersect(Vector2 point1, Vector2 point2, Vector2 point3, Vector2 point4, out Vector2 intersectionPoint)

Parameters:

Name Type Description
point1 Strawberry.Math.Vector2 The first point of the first line segment.
point2 Strawberry.Math.Vector2 The second point of the first line segment.
point3 Strawberry.Math.Vector2 The first point of the second line segment.
point4 Strawberry.Math.Vector2 The second point of the second line segment.
intersectionPoint out Strawberry.Math.Vector2 This is set to the intersection point if an intersection is detected.

Returns: True if an intersection is detected, false otherwise.

LineSegmentVerticesIntersect static

Get all intersections between a line segment and a list of vertices representing a polygon. The vertices reuse adjacent points, so for example edges one and two are between the first and second vertices and between the second and third vertices. The last edge is between vertex vertices.Count - 1 and verts0. (ie, vertices from a Geometry or AABB)

Vertices LineSegmentVerticesIntersect(ref Vector2 point1, ref Vector2 point2, Vertices vertices)

Parameters:

Name Type Description
point1 ref Strawberry.Math.Vector2 The first point of the line segment to test
point2 ref Strawberry.Math.Vector2 The second point of the line segment to test.
vertices tainicom.Aether.Physics2D.Common.Vertices The vertices, as described above

LineSegmentAABBIntersect static

Get all intersections between a line segment and an AABB.

Vertices LineSegmentAABBIntersect(ref Vector2 point1, ref Vector2 point2, AABB aabb)

Parameters:

Name Type Description
point1 ref Strawberry.Math.Vector2 The first point of the line segment to test
point2 ref Strawberry.Math.Vector2 The second point of the line segment to test.
aabb tainicom.Aether.Physics2D.Collision.AABB The AABB that is used for testing intersection.