Skip to content

Commit

Permalink
Add code comments justifying use of specialized methods (#89)
Browse files Browse the repository at this point in the history
* Add why-special note for BezierCurve

* Add why-special notes for conics

* Add why-special notes for geometries with infinite extent

* Add why-special notes for Ring and Rope

* Add why-special notes for simplex types
  • Loading branch information
mikeingold authored Sep 25, 2024
1 parent 0a6eaaf commit d27fa22
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/specializations/BezierCurve.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
################################################################################
# Specialized Methods for BezierCurve
#
# Why Specialized?
# The parametric function in Meshes.jl for BezierCurve accepts an argument
# of type Meshes.BezierEvalMethod, in which the method for generating
# parametric points along the curve is specified. These specialized methods
# are essentially identical to the generic ones, except that they provide a
# keyword argument and pass through the specified algorithm choice.
################################################################################

function lineintegral(
Expand Down
6 changes: 6 additions & 0 deletions src/specializations/ConeSurface.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
################################################################################
# Specialized Methods for ConeSurface
#
# Why Specialized?
# The parametric function that Meshes.jl currently implements for ConeSurface
# only parameterizes the rounded walls of the cone, but this Geometry surface is
# defined as including the circular base surface as well. These methods simply
# integrate both the base and walls and return the sum of the two integrals.
################################################################################

function integral(
Expand Down
6 changes: 6 additions & 0 deletions src/specializations/CylinderSurface.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
################################################################################
# Specialized Methods for CylinderSurface
#
# Why Specialized?
# The parametric function that Meshes.jl currently implements for CylinderSurface
# only parameterizes the rounded walls, but this Geometry surface is defined as
# including the top and bottom circular base surfaces as well. These methods
# simply integrate the base and walls and return the sum of the three integrals.
################################################################################

function integral(
Expand Down
6 changes: 6 additions & 0 deletions src/specializations/FrustumSurface.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
################################################################################
# Specialized Methods for FrustumSurface
#
# Why Specialized?
# The parametric function that Meshes.jl currently implements for FrustumSurface
# only parameterizes the rounded walls, but this Geometry surface is defined as
# including the truncated top and bottom surfaces as well. These methods simply
# integrate both the walls and the ends and return the sum of the these integrals.
################################################################################

function integral(
Expand Down
5 changes: 5 additions & 0 deletions src/specializations/Line.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
################################################################################
# Specialized Methods for Line
#
# Why Specialized?
# The Line geometry is a special case, representing a line of infinite length
# that passes through two points. This requires another domain transformation
# mapping from the typical parametric region [0,1] to an infinite one (-∞,∞).
################################################################################

function integral(
Expand Down
6 changes: 6 additions & 0 deletions src/specializations/Plane.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
################################################################################
# Specialized Methods for Plane
#
# Why Specialized?
# The Plane geometry is a special case, representing a planar surface with
# infinite extent along two basis vectors. This requires a pair of domain
# transformations mapping from the typical parametric region [0,1]² to an
# infinite one (-∞,∞)².
################################################################################

function integral(
Expand Down
6 changes: 6 additions & 0 deletions src/specializations/Ray.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
################################################################################
# Specialized Methods for Ray
#
# Why Specialized?
# The Ray geometry is a special case, representing a ray, originating at a point
# and extending an infinite length in a particular direction. This requires
# a domain transformation mapping from the typical parametric region [0,1] to
# an infinite one (-∞,∞).
################################################################################

function integral(
Expand Down
6 changes: 6 additions & 0 deletions src/specializations/Ring.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
################################################################################
# Specialized Methods for Ring
#
# Why Specialized?
# The Ring geometry defines a polytope whose length spans segments between
# consecutive points that form a closed path. Meshes.jl does not define a
# parametric function for Ring's, but they can be decomposed into their
# constituent Segment's, integrated separately, and then summed.
################################################################################

function integral(
Expand Down
6 changes: 6 additions & 0 deletions src/specializations/Rope.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
################################################################################
# Specialized Methods for Rope
#
# Why Specialized?
# The Rope geometry defines a polytope whose length spans segments between
# consecutive points. Meshes.jl does not define a parametric function for
# Rope's, but they can be decomposed into their constituent Segment's,
# integrated separately, and then summed.
################################################################################

function integral(
Expand Down
7 changes: 7 additions & 0 deletions src/specializations/Tetrahedron.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
################################################################################
# Specialized Methods for Tetrahedron
#
# Why Specialized?
# The Tetrahedron geometry is a volumetric simplex whose parametric function
# in Meshes.jl uses barycentric coordinates on a domain {u,v,w} with coordinates
# that are non-negative and bound by the surface $u + v + w ≤ 1$. This requires
# a multi-step domain transformation whose derivation is detailed in the package
# documentation.
################################################################################

function integral(
Expand Down
7 changes: 7 additions & 0 deletions src/specializations/Triangle.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
################################################################################
# Specialized Methods for Triangle
#
# Why Specialized?
# The Triangle geometry is a surface simplex whose parametric function in
# Meshes.jl uses barycentric coordinates on a domain {u,v} with coordinates
# that are non-negative and bound by the surface $u + v ≤ 1$. This requires a
# multi-step domain transformation whose derivation is detailed in the package
# documentation.
################################################################################

"""
Expand Down

0 comments on commit d27fa22

Please sign in to comment.