@@ -66,97 +66,10 @@ Vector2
66
66
Line2
67
67
-----
68
68
69
- .. class :: Line2
70
-
71
- Defines a two-dimensional directed line segment defined by two points.
72
- This class is mostly used as a way to cache information that is
73
- regularly required when working on geometrical problems.
74
-
75
- .. note ::
76
-
77
- Lines should be used as if they were completely immutable to ensure
78
- correctness. All attributes of Line2 can be reconstructed from the two
79
- points, and thus cannot be changed on their own and must be recalculated
80
- if there were any changes to `start ` or `end `.
81
-
82
- .. note ::
83
-
84
- To prevent unnecessary recalculations, many functions on lines accept an
85
- 'offset' argument, which is used to perform calculations on lines that
86
- are simply shifts of other lines.
87
-
88
- .. attribute :: Line2.start
89
-
90
- `Vector2 ` the start of this line
91
-
92
- .. attribute :: Line2.end
93
-
94
- `Vector2 ` the end of this line
95
-
96
- .. attribute :: Line2.delta
97
-
98
- `Vector2 ` from start to end
99
-
100
- .. attribute :: Line2.axis
101
-
102
- `Vector2 ` normalized `delta `
103
-
104
- .. attribute :: Line2.normal
105
-
106
- `Vector2 ` normalized normal of `axis `
107
-
108
- .. attribute :: Line2.magnitude_squared
109
-
110
- `numerical ` square of the magnitude of the line
111
-
112
- .. attribute :: Line2.magnitude
113
-
114
- `numerical ` magnitude of the line
115
-
116
- .. attribute :: Line2.min_x
117
-
118
- `numerical ` minimum x-value on the line
119
-
120
- .. attribute :: Line2.min_y
121
-
122
- `numerical ` minimum y-value on the line
123
-
124
- .. attribute :: Line2.max_x
125
-
126
- `numerical ` maximum x-value on the line
127
-
128
- .. attribute :: Line2.max_y
129
-
130
- `numerical ` maximum y-value on the line
131
-
132
- .. attribute :: Line2.slope
133
-
134
- `numerical ` (including +inf and -inf) slope of the line
135
-
136
- .. attribute :: Line2.y_intercept
137
-
138
- `numerical or None ` y_intercept of the line (or None if `vertical `)
139
-
140
- .. attribute :: Line2.horizontal
141
-
142
- `bool ` true if ``slope == 0 ``, false otherwise
143
-
144
- .. attribute :: Line2.vertical
145
-
146
- `bool ` true if ``slope == float('+inf') or slope == float('-inf') ``, false otherwise
147
-
148
- .. staticmethod :: intersects_line(line1, line2, offset1, offset2)
149
-
150
- - **line1 ** - `Line2 ` first line
151
- - **line2 ** - `Line2 ` second line
152
- - **offset1 ** - `Vector2 ` offset of first line
153
- - **offset2 ** - `Vector2 ` offset of second line
154
- - **Return Value ** - `bool, bool ` touches, overlaps
69
+ .. autoclass :: pygorithm.geometry.line2.Line2
70
+ :members:
71
+ :special-members:
155
72
156
- Determines if the two lines at the specified offsets are touching and/or
157
- overlapping. Two lines touch if they share endpoints, two lines overlap
158
- if they intersect on any point that is not an endpoint.
159
-
160
73
Axis-Aligned Line
161
74
-----------------
162
75
0 commit comments