Skip to content

Commit 2a9c9e6

Browse files
committed
Ray; update documentation and naming
1 parent 3fe455a commit 2a9c9e6

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

differ/shapes/Polygon.hx

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ import differ.shapes.*;
55
import differ.data.*;
66
import differ.sat.*;
77

8-
/** A polygon collision shape */
8+
/** A polygonal collision shape */
99
class Polygon extends Shape {
1010

11-
1211
/** The transformed (rotated/scale) vertices cache */
1312
public var transformedVertices ( get, never ) : Array<Vector>;
1413
/** The vertices of this shape */

differ/shapes/Ray.hx

+17-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import differ.math.*;
44
import differ.shapes.*;
55
import differ.data.*;
66

7+
/** A ray with a start, end, direction
8+
and infinite state for collision queries. */
79
class Ray {
810

911
/** The start point of the ray. */
@@ -15,12 +17,12 @@ class Ray {
1517
Updates only when the dir value is accessed. */
1618
public var dir (get, never):Vector;
1719
/** Whether or not the ray is infinite. */
18-
public var infinite:InfiniteMode;
20+
public var infinite:InfiniteState;
1921

2022
/** Create a new ray with the start and end point,
2123
which determine the direction of the ray, and optionally specifying
22-
that this ray is an infinite one. */
23-
public function new(_start:Vector, _end:Vector, ?_infinite:InfiniteMode) {
24+
that this ray is infinite in some way. */
25+
public function new(_start:Vector, _end:Vector, ?_infinite:InfiniteState) {
2426

2527
start = _start;
2628
end = _end;
@@ -42,8 +44,17 @@ class Ray {
4244

4345
}
4446

45-
enum InfiniteMode {
47+
/** A flag for the infinite state of a Ray. */
48+
enum InfiniteState {
49+
50+
/** The line is a fixed length
51+
between the start and end points. */
52+
not_infinite;
53+
/** The line is infinite
54+
from it's starting point. */
4655
infinite_from_start;
56+
/** The line is infinite in both
57+
directions from it's starting point. */
4758
infinite;
48-
not_infinite;
49-
}
59+
60+
} //InfiniteState

0 commit comments

Comments
 (0)