Skip to content

Commit 600ac7d

Browse files
Tokazamaasinghvi17
authored andcommitted
Add docstring heads
1 parent 4658133 commit 600ac7d

File tree

8 files changed

+74
-10
lines changed

8 files changed

+74
-10
lines changed

src/geometry_primitives.jl

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ end
181181
# Some more primitive types
182182

183183
"""
184+
HyperSphere{N, T}
185+
184186
A `HyperSphere` is a generalization of a sphere into N-dimensions.
185187
A `center` and radius, `r`, must be specified.
186188
"""
@@ -189,16 +191,22 @@ struct HyperSphere{N, T} <: GeometryPrimitive{N, T}
189191
r::T
190192
end
191193
"""
192-
An alias for a HyperSphere of dimension 2. i.e. `Circle{T}` -> `HyperSphere{2, T}`
194+
Circle{T}
195+
196+
An alias for a HyperSphere of dimension 2. (i.e. `HyperSphere{2, T}`)
193197
"""
194198
const Circle{T} = HyperSphere{2, T}
195199

196200
"""
197-
An alias for a HyperSphere of dimension 3. i.e. `Sphere{T}` -> `HyperSphere{3, T}`
201+
Sphere{T}
202+
203+
An alias for a HyperSphere of dimension 3. (i.e. `HyperSphere{3, T}`)
198204
"""
199205
const Sphere{T} = HyperSphere{3, T}
200206

201207
"""
208+
Quad{T}
209+
202210
A rectangle in 3D space.
203211
"""
204212
struct Quad{T} <: GeometryPrimitive{3, T}
@@ -219,6 +227,8 @@ struct Particle{N, T} <: GeometryPrimitive{N, T}
219227
end
220228

221229
"""
230+
Cylinder{N, T}
231+
222232
A `Cylinder` is a 2D rectangle or a 3D cylinder defined by its origin point,
223233
its extremity and a radius. `origin`, `extremity` and `r`, must be specified.
224234
"""
@@ -229,6 +239,9 @@ struct Cylinder{N, T} <: GeometryPrimitive{N, T}
229239
end
230240

231241
"""
242+
Cylinder2{T}
243+
Cylinder3{T}
244+
232245
A `Cylinder2` or `Cylinder3` is a 2D/3D cylinder defined by its origin point,
233246
its extremity and a radius. `origin`, `extremity` and `r`, must be specified.
234247
"""

src/lines.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
"""
3+
intersect(a::Line, b::Line) -> Point
4+
35
Intersection of 2 line segmens `a` and `b`.
46
Returns intersection_found::Bool, intersection_point
57
"""
@@ -75,6 +77,8 @@ function consecutive_pairs(arr)
7577
end
7678

7779
"""
80+
self_intersections(points::AbstractVector{AbstractPoint})
81+
7882
Finds all self intersections of polygon `points`
7983
"""
8084
function self_intersections(points::AbstractVector{<:AbstractPoint})
@@ -99,6 +103,8 @@ function self_intersections(points::AbstractVector{<:AbstractPoint})
99103
end
100104

101105
"""
106+
split_intersections(points::AbstractVector{AbstractPoint})
107+
102108
Splits polygon `points` into it's self intersecting parts. Only 1 intersection
103109
is handled right now.
104110
"""

src/meshes.jl

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ const PointWithUVNormal{Dim, T} = PointMeta{Dim, T, Point{Dim, T}, (:normals, :u
1111
const PointWithUVWNormal{Dim, T} = PointMeta{Dim, T, Point{Dim, T}, (:normals, :uvw), Tuple{Vec{3, T}, Vec{3, T}}}
1212

1313
"""
14-
Abstract Mesh with triangle elements
14+
TriangleMesh{Dim, T, PointType}
15+
16+
Abstract Mesh with triangle elements of eltype `T`.
1517
"""
1618
const TriangleMesh{Dim, T, PointType} = AbstractMesh{TriangleP{Dim, T, PointType}}
1719

1820
"""
19-
PlainMesh
21+
PlainMesh{Dim, T}
22+
2023
Triangle mesh with no meta information (just points + triangle faces)
2124
"""
2225
const PlainMesh{Dim, T} = TriangleMesh{Dim, T, Point{Dim, T}}
@@ -25,7 +28,8 @@ const GLPlainMesh2D = GLPlainMesh{2}
2528
const GLPlainMesh3D = GLPlainMesh{3}
2629

2730
"""
28-
UVMesh
31+
UVMesh{Dim, T}
32+
2933
PlainMesh with texture coordinates meta at each point.
3034
`uvmesh.uv isa AbstractVector{Vec2f0}`
3135
"""
@@ -35,7 +39,8 @@ const GLUVMesh2D = UVMesh{2}
3539
const GLUVMesh3D = UVMesh{3}
3640

3741
"""
38-
NormalMesh
42+
NormalMesh{Dim, T}
43+
3944
PlainMesh with normals meta at each point.
4045
`normalmesh.normals isa AbstractVector{Vec3f0}`
4146
"""
@@ -45,7 +50,8 @@ const GLNormalMesh2D = GLNormalMesh{2}
4550
const GLNormalMesh3D = GLNormalMesh{3}
4651

4752
"""
48-
NormalUVMesh
53+
NormalUVMesh{Dim, T}
54+
4955
PlainMesh with normals and uv meta at each point.
5056
`normalmesh.normals isa AbstractVector{Vec3f0}`
5157
`normalmesh.uv isa AbstractVector{Vec2f0}`
@@ -56,7 +62,8 @@ const GLNormalUVMesh2D = GLNormalUVMesh{2}
5662
const GLNormalUVMesh3D = GLNormalUVMesh{3}
5763

5864
"""
59-
NormalUVWMesh
65+
NormalUVWMesh{Dim, T}
66+
6067
PlainMesh with normals and uvw (texture coordinates in 3D) meta at each point.
6168
`normalmesh.normals isa AbstractVector{Vec3f0}`
6269
`normalmesh.uvw isa AbstractVector{Vec3f0}`
@@ -175,7 +182,10 @@ function normal_mesh(points::AbstractVector{<:AbstractPoint},
175182
end
176183

177184
"""
178-
Calculate the signed volume of one tetrahedron. Be sure the orientation of your surface is right.
185+
volume(triangle)
186+
187+
Calculate the signed volume of one tetrahedron. Be sure the orientation of your
188+
surface is right.
179189
"""
180190
function volume(triangle::Triangle) where {VT,FT}
181191
v1, v2, v3 = triangle
@@ -184,7 +194,10 @@ function volume(triangle::Triangle) where {VT,FT}
184194
end
185195

186196
"""
187-
Calculate the signed volume of all tetrahedra. Be sure the orientation of your surface is right.
197+
volume(mesh)
198+
199+
Calculate the signed volume of all tetrahedra. Be sure the orientation of your
200+
surface is right.
188201
"""
189202
function volume(mesh::Mesh) where {VT, FT}
190203
return sum(volume, mesh)

src/metadata.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ end
1010

1111
"""
1212
getcolumns(t, colnames::Symbol...)
13+
1314
Gets a column from any Array like (Table/AbstractArray).
1415
For AbstractVectors, a column will be the field names of the element type.
1516
"""
@@ -21,6 +22,7 @@ getcolumn(t, colname::Symbol) = getcolumns(t, colname)[1]
2122

2223
"""
2324
MetaType(::Type{T})
25+
2426
Returns the Meta Type corresponding to `T`
2527
E.g:
2628
```julia
@@ -30,6 +32,7 @@ MetaType(::Type{T}) where T = error("No Meta Type for $T")
3032

3133
"""
3234
MetaFree(::Type{T})
35+
3336
Returns the original type containing no metadata for `T`
3437
E.g:
3538
```julia
@@ -39,6 +42,7 @@ MetaFree(::Type{T}) where T = error("No meta free Type for $T")
3942

4043
"""
4144
meta(x::MetaObject)
45+
4246
Returns the metadata of `x`
4347
"""
4448
meta(x::T) where T = error("$T has no meta!")

src/offsetintegers.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
"""
3+
OffsetInteger{O, T}
4+
35
OffsetInteger type mainly for indexing.
46
* `O` - The offset relative to Julia arrays. This helps reduce copying when
57
communicating with 0-indexed systems such ad OpenGL.

src/rectangles.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
"""
3+
HyperRectangle{N, T}
4+
35
A `HyperRectangle` is a generalization of a rectangle into N-dimensions.
46
Formally it is the cartesian product of intervals, which is represented by the
57
`origin` and `width` fields, whose indices correspond to each of the `N` axes.
@@ -61,6 +63,8 @@ end
6163

6264

6365
"""
66+
Rect(vals::Number...)
67+
6468
```
6569
Rect(vals::Number...)
6670
```
@@ -162,6 +166,8 @@ width(prim::Rect) = prim.widths[1]
162166
height(prim::Rect) = prim.widths[2]
163167

164168
"""
169+
split(rectangle, axis, value)
170+
165171
Splits an Rect into two along an axis at a given location.
166172
"""
167173
split(b::Rect, axis, value::Integer) = _split(b, axis, value)
@@ -180,6 +186,8 @@ end
180186
# Algebraic operations
181187

182188
"""
189+
*(m::Mat, h::Rect)
190+
183191
Transform a `Rect` using a matrix. Maintains axis-align properties
184192
so a significantly larger Rect may be generated.
185193
"""
@@ -310,11 +318,15 @@ function Base.union(h1::Rect{N}, h2::Rect{N}) where N
310318
end
311319

312320
"""
321+
diff(h1::Rect, h2::Rect)
322+
313323
Perform a difference between two Rects.
314324
"""
315325
diff(h1::Rect, h2::Rect) = h1
316326

317327
"""
328+
intersect(h1::Rect, h2::Rect)
329+
318330
Perform a intersection between two Rects.
319331
"""
320332
function intersect(h1::Rect{N}, h2::Rect{N}) where N
@@ -457,6 +469,8 @@ end
457469
# Containment
458470

459471
"""
472+
contains(b1::Rect, b2::Rect)
473+
460474
Check if Rects are contained in each other. This does not use
461475
strict inequality, so Rects may share faces and this will still
462476
return true.
@@ -471,6 +485,8 @@ function Base.in(b2::Rect{N}, b1::Rect{N}) where N
471485
end
472486

473487
"""
488+
contains(b1::Rect{N, T}, pt::VecTypes)
489+
474490
Check if a point is contained in a Rect. This will return true if
475491
the point is on a face of the Rect.
476492
"""

src/triangulation.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ The above copyright notice and this permission notice shall be included in all c
1313
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1414
=#
1515
"""
16+
area(vertices::AbstractVector{AbstractPoint{3}}, face::TriangleFace)
17+
1618
Calculate the area of one triangle.
1719
"""
1820
function area(vertices::AbstractVector{<:AbstractPoint{3, VT}}, face::TriangleFace{FT}) where {VT,FT}
@@ -21,6 +23,8 @@ function area(vertices::AbstractVector{<:AbstractPoint{3, VT}}, face::TriangleFa
2123
end
2224

2325
"""
26+
area(vertices::AbstractVector{AbstractPoint{3}}, faces::AbstractVector{TriangleFace})
27+
2428
Calculate the area of all triangles.
2529
"""
2630
function area(
@@ -53,6 +57,8 @@ function area(contour::AbstractVector{Point{3, T}}) where {T}
5357
end
5458

5559
"""
60+
in(point, triangle)
61+
5662
InsideTriangle decides if a point P is Inside of the triangle
5763
defined by A, B, C.
5864
"""

src/viewtypes.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
"""
2+
TupleView{T, N, Skip, A}
3+
24
TupleView, groups elements of an array as tuples.
35
N is the dimension of the tuple, M tells how many elements to skip to the next tuple.
46
By default TupleView{N} defaults to skip N items.
@@ -92,6 +94,8 @@ end
9294
end
9395

9496
"""
97+
FaceView{Elemnt, Point, Face, P, F}
98+
9599
FaceView enables to link one array of points via a face array, to generate one
96100
abstract array of elements.
97101
E.g., this becomes possible:

0 commit comments

Comments
 (0)