You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/primitives.md
+18-7Lines changed: 18 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ GeometryBasics comes with a few predefined primitives:
9
9
10
10
#### HyperRectangle
11
11
12
-
A `Rect{D, T} = HyperRectangle{D, T}` is a D-dimensional axis-aligned
12
+
A `Rect{D, T} = HyperRectangle{D, T}` is a D-dimensional axis-aligned
13
13
hyperrectangle defined by an origin and a size.
14
14
15
15
```@repl rects
@@ -33,7 +33,7 @@ Shorthands:
33
33
34
34
#### Sphere and Circle
35
35
36
-
`Circle` and `Sphere` are the 2 and 3 dimensional variants of `HyperSphere`.
36
+
`Circle` and `Sphere` are the 2 and 3 dimensional variants of `HyperSphere`.
37
37
They are defined by an origin and a radius.
38
38
While you can technically create a HyperSphere of any dimension, decomposition
39
39
is only defined in 2D and 3D.
@@ -54,23 +54,34 @@ The coordinates of Circle are defined in anti-clockwise order.
54
54
55
55
A `Cylinder` is a 3D shape defined by two points and a radius.
56
56
57
-
58
57
```@setup cylinder
59
58
using GeometryBasics
60
59
```
61
60
```@repl cylinder
62
61
c = Cylinder(Point3f(-1, 0, 0), Point3f(0, 0, 1), 0.3f0) # start point, end point, radius
63
62
```
64
63
65
-
Cylinder supports normals an Tessellation, but currently no texture coordinates.
64
+
Cylinder supports normals and Tessellation, but currently no texture coordinates.
65
+
66
+
#### Cone
67
+
68
+
A `Cone` is also defined by two points and a radius, but the radius decreases to 0 from the start point to the tip.
69
+
70
+
```@setup cone
71
+
using GeometryBasics
72
+
```
73
+
```@repl cone
74
+
c = Cone(Point3f(-1, 0, 0), Point3f(0, 0, 1), 0.3f0) # start point, tip point, radius
75
+
```
76
+
77
+
Cone supports normals and Tessellation, but currently no texture coordinates.
66
78
67
79
#### Pyramid
68
80
69
81
`Pyramid` corresponds to a pyramid shape with a square base and four triangles
70
82
coming together into a sharp point.
71
83
It is defined by by the center point of the base, its height and its width.
72
84
73
-
74
85
```@setup pyramid
75
86
using GeometryBasics
76
87
```
@@ -132,7 +143,7 @@ end
132
143
```
133
144
134
145
To connect these points into a mesh, we need to generate a set of faces.
135
-
The faces of a parallelepiped are parallelograms, which we can describe with `QuadFace`.
146
+
The faces of a parallelepiped are parallelograms, which we can describe with `QuadFace`.
136
147
Here we should be conscious of the winding direction of faces.
137
148
They are often used to determine the front vs the backside of a (2D) face.
138
149
For example GeometryBasics normal generation and OpenGL's backface culling assume a counter-clockwise winding direction to correspond to a front-facing face.
@@ -187,7 +198,7 @@ function GeometryBasics.texturecoordinates(::Parallelepiped{T}) where {T}
187
198
uvs = [Vec2f(x, y) for x inrange(0, 1, length=4) for y inrange(0, 1, 3)]
0 commit comments