|
Banjo API 1.1.0-alpha
Low-level C99 game development API
|
Functions | |
| bj_bool | bj_segment_hits_segment_2d (struct bj_vec2 a0, struct bj_vec2 a1, struct bj_vec2 b0, struct bj_vec2 b1) |
| bj_bool | bj_check_segments_hit (struct bj_vec2 a0, struct bj_vec2 a1, struct bj_vec2 b0, struct bj_vec2 b1) |
| bj_bool | bj_circle_hits_segment_2d (struct bj_vec2 c, bj_real r, struct bj_vec2 l0, struct bj_vec2 l1) |
| bj_bool | bj_check_circle_segment_hit (struct bj_vec2 c, bj_real r, struct bj_vec2 l0, struct bj_vec2 l1) |
2D Geometry utilities
| bj_bool bj_check_circle_segment_hit | ( | struct bj_vec2 | c, |
| bj_real | r, | ||
| struct bj_vec2 | l0, | ||
| struct bj_vec2 | l1 ) |
| bj_bool bj_check_segments_hit | ( | struct bj_vec2 | a0, |
| struct bj_vec2 | a1, | ||
| struct bj_vec2 | b0, | ||
| struct bj_vec2 | b1 ) |
| bj_bool bj_circle_hits_segment_2d | ( | struct bj_vec2 | c, |
| bj_real | r, | ||
| struct bj_vec2 | l0, | ||
| struct bj_vec2 | l1 ) |
Tell whether a circle overlaps a line segment.
Tests whether a circle centered at c with radius r intersects the line segment from l0 to l1.
| c | Circle center position. |
| r | Circle radius. |
| l0 | Start point of the line segment. |
| l1 | End point of the line segment. |
Touching counts: a segment tangent to the circle, or ending on it, hits, and so does one through the centre of a circle of radius 0. A point at a distance of up to r + BJ_EPSILON from c counts as on the circle, and a radius below 0 counts as a 0 one.
| bj_bool bj_segment_hits_segment_2d | ( | struct bj_vec2 | a0, |
| struct bj_vec2 | a1, | ||
| struct bj_vec2 | b0, | ||
| struct bj_vec2 | b1 ) |
Tell whether two line segments cross.
Tests whether the line segment from a0 to a1 intersects with the segment from b0 to b1 in 2D space.
| a0 | Start point of first segment. |
| a1 | End point of first segment. |
| b0 | Start point of second segment. |
| b1 | End point of second segment. |
Touching counts: segments that meet only at an endpoint, or that overlap along one line, hit. The tests allow BJ_EPSILON as an absolute tolerance, on the position along each segment, from 0 at its start to 1 at its end, and on the cross products that tell whether the segments are parallel or on one line.
The mold for future collision predicates is bj_<shape>_hits_<shape>_2d.