Skip to content

Commit 957bfca

Browse files
authored
Merge pull request bevyengine#4 from Weibye/dev/remove-point
Removing point as a primitive type
2 parents 550e522 + 46ae46c commit 957bfca

1 file changed

Lines changed: 18 additions & 23 deletions

File tree

rfcs/12-primitive-shapes.md

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ The complete overview of shapes, their dimensions and their names can be seen in
8585
| Circle | Circle | - | A circle defined by its radius |
8686
| Polygon | Polygon | - | A closed shape in a plane defined by a finite number of line-segments between vertices |
8787
| RegularPolygon | RegularPolygon | - | A polygon where all vertices lies on the circumscribed circle, equally far apart |
88-
| Point | Point2d | Point3d | A single point in space |
8988
| Plane | Plane2d | Plane3d | An unbounded plane defined by a position and normal |
9089
| Direction | Direction2d | Direction3d | A normalized vector pointing in a direction |
9190
| Ray | Ray2d | Ray3d | An infinite half-line pointing in a direction |
@@ -144,45 +143,43 @@ trait Collider3d {
144143
### 2D Geometry Types
145144

146145
```rust
147-
struct Point2d(Vec2)
148-
149146
struct Direction2d(Vec2)
150147
impl Meshable for Direction2d {}
151148

152149
struct Ray2d {
153-
point: Point2d,
150+
point: Vec2,
154151
direction: Direction2d
155152
}
156153
impl Meshable for Ray2d {}
157154

158155
struct Line2d {
159-
point: Point2d,
156+
point: Vec2,
160157
direction: Direction2d,
161158
}
162159
impl Meshable for Line2d {}
163160

164161
/// A finite line between two vertices
165162
struct LineSegment2d {
166-
start: Point2d,
167-
end: Point2d,
163+
start: Vec2,
164+
end: Vec2,
168165
}
169166
impl Meshable for LineSegment2d {}
170167

171168
/// A line drawn along a path of vertices
172169
struct PolyLine2d<const N: usize>{
173-
points: [Point2d; N],
170+
points: [Vec2; N],
174171
}
175172
impl Meshable for PolyLine2d {}
176173

177-
struct Triangle2d([Point2d; 3]);
174+
struct Triangle2d([Vec2; 3]);
178175
impl Meshable for Triangle2d {}
179176

180-
struct Quad2d([Point2d; 4]);
177+
struct Quad2d([Vec2; 4]);
181178
impl Meshable for Quad2d {}
182179

183180
/// A closed shape in a plane defined by a finite number of line-segments between vertices
184181
struct Polygon2d <const N: usize>{
185-
points: [Point2d; N],
182+
points: [Vec2; N],
186183
}
187184
impl Meshable for Polygon2d {}
188185

@@ -273,21 +270,19 @@ impl Collider2d for CapsuleCollider2d {}
273270
### 3D Geometry Types
274271

275272
```rust
276-
struct Point3d(Vec3)
277-
278273
/// Vector direction in 3D space that is guaranteed to be normalized through its getter/setter.
279274
struct Direction3d(Vec3)
280275
impl Meshable for Direction3d {}
281276

282277
struct Plane3d {
283-
point: Point3d,
278+
point: Vec3,
284279
normal: Direction3d,
285280
}
286281
impl Meshable for Plane3d {}
287282

288283
/// Differentiates a line from a ray, where a line is infinite and a ray is directional half-line, although their underlying representation is the same.
289284
struct Ray3d(
290-
point: Point3d,
285+
point: Vec3,
291286
direction: Direction3d,
292287
);
293288
impl Meshable for Ray3d {}
@@ -296,29 +291,29 @@ impl Meshable for Ray3d {}
296291

297292
/// Unbounded line in 3D space with directionality
298293
struct Line3d {
299-
point: Point3d,
294+
point: Vec3,
300295
direction: Direction3d,
301296
}
302297
impl Meshable for Line3d {}
303298

304299
/// A line segment bounded by two points
305300
struct LineSegment3d {
306-
start: Point3d,
307-
end: Point3d,
301+
start: Vec3,
302+
end: Vec3,
308303
}
309304
impl Meshable for LineSegment3d {}
310305

311306
/// A line drawn along a path of points
312307
struct PolyLine3d {
313-
points: Vec<Point3d>,
308+
points: Vec<Vec3>,
314309
}
315310
impl Meshable for PolyLine3d {}
316311

317-
struct Triangle3d([Point3d; 3]);
312+
struct Triangle3d([Vec3; 3]);
318313
impl Meshable for Triangle3d {}
319314
impl Collider for Triangle3d {}
320315

321-
struct Quad3d([Point3d; 4]);
316+
struct Quad3d([Vec3; 4]);
322317
impl Meshable for Quad3d {}
323318
impl Collider for Quad3d {}
324319

@@ -500,7 +495,7 @@ The bounding volumes sections of this RFC cover how these types could be used fo
500495

501496
```rust
502497
let ray = Ray3d::X;
503-
let sphere = SphereCollider::new{Sphere{1.0}, Point3d::x(5.0));
498+
let sphere = SphereCollider::new{Sphere{1.0}, Vec3::x(5.0));
504499
let intersection = sphere.raycast(ray);
505500
```
506501

@@ -510,7 +505,7 @@ The notes for `Direction` mention it is gauranteed to be normalized through its
510505

511506
```rust
512507
struct Plane3d {
513-
point: Point3d,
508+
point: Vec3,
514509
normal: Direction3d,
515510
}
516511

0 commit comments

Comments
 (0)