Skip to content

Commit 7c353fe

Browse files
committed
add docs
1 parent 4d4b560 commit 7c353fe

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

docs/src/primitives.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ GeometryBasics comes with a few predefined primitives:
99

1010
#### HyperRectangle
1111

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
1313
hyperrectangle defined by an origin and a size.
1414

1515
```@repl rects
@@ -33,7 +33,7 @@ Shorthands:
3333

3434
#### Sphere and Circle
3535

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`.
3737
They are defined by an origin and a radius.
3838
While you can technically create a HyperSphere of any dimension, decomposition
3939
is only defined in 2D and 3D.
@@ -54,7 +54,6 @@ The coordinates of Circle are defined in anti-clockwise order.
5454

5555
A `Cylinder` is a 3D shape defined by two points and a radius.
5656

57-
5857
```@setup cylinder
5958
using GeometryBasics
6059
```
@@ -64,13 +63,25 @@ c = Cylinder(Point3f(-1, 0, 0), Point3f(0, 0, 1), 0.3f0) # start point, end poin
6463

6564
Cylinder supports normals an Tessellation, but currently no texture coordinates.
6665

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 an Tessellation, but currently no texture coordinates.
78+
6779
#### Pyramid
6880

6981
`Pyramid` corresponds to a pyramid shape with a square base and four triangles
7082
coming together into a sharp point.
7183
It is defined by by the center point of the base, its height and its width.
7284

73-
7485
```@setup pyramid
7586
using GeometryBasics
7687
```
@@ -132,7 +143,7 @@ end
132143
```
133144

134145
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`.
136147
Here we should be conscious of the winding direction of faces.
137148
They are often used to determine the front vs the backside of a (2D) face.
138149
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}
187198
uvs = [Vec2f(x, y) for x in range(0, 1, length=4) for y in range(0, 1, 3)]
188199
fs = QuadFace{Int}[
189200
(1, 2, 5, 4), (2, 3, 6, 5),
190-
(4, 5, 8, 7), (5, 6, 9, 8),
201+
(4, 5, 8, 7), (5, 6, 9, 8),
191202
(7, 8, 11, 10), (8, 9, 12, 11)
192203
]
193204
return FaceView(uvs, fs)

0 commit comments

Comments
 (0)