Skip to content

Commit f4518c8

Browse files
committed
Add comments
1 parent cdac6ec commit f4518c8

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

src/specializations/BezierCurve.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ end
5050
# Parametric
5151
################################################################################
5252

53+
# Wrap (::BezierCurve)(t, ::BezierEvalMethod) into f(t) by embedding second argument
5354
function _parametric(curve::Meshes.BezierCurve, t, alg::Meshes.BezierEvalMethod)
5455
return curve(t, alg)
5556
end

src/specializations/Line.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ function integral(
1313
rule::IntegrationRule;
1414
kwargs...
1515
)
16+
# Generate a _ParametricGeometry whose parametric function spans the domain [0, 1]
1617
paramfunction(t) = _parametric(line, t)
17-
param_line = _ParametricGeometry(paramfunction, 1)
18+
19+
# Integrate the _ParametricGeometry using the standard methods
1820
return _integral(f, param_line, rule; kwargs...)
1921
end
2022

2123
################################################################################
2224
# Parametric
2325
################################################################################
2426

25-
# Map [0, 1] (-∞, ∞)
27+
# Map argument domain from [0, 1] to (-∞, ∞) for (::Line)(t)
2628
function _parametric(line::Meshes.Line, t)
2729
# [-1, 1] ↦ (-∞, ∞)
2830
f1(t) = t / (1 - t^2)

src/specializations/Plane.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,24 @@ function integral(
1414
rule::IntegrationRule;
1515
kwargs...
1616
)
17+
# Generate a _ParametricGeometry whose parametric function spans the domain [0, 1]²
1718
paramfunction(t1, t2) = _parametric(plane, t1, t2)
18-
param_plane = _ParametricGeometry(paramfunction, 2)
19+
20+
# Integrate the _ParametricGeometry using the standard methods
1921
return _integral(f, param_plane, rule; kwargs...)
2022
end
2123

2224
############################################################################################
2325
# Parametric
2426
############################################################################################
2527

26-
# Map [0, 1]² (-∞, ∞)²
28+
# Map argument domain from [0, 1]² to (-∞, ∞)² for (::Plane)(t1, t2)
2729
function _parametric(plane::Meshes.Plane, t1, t2)
30+
# [-1, 1] ↦ (-∞, ∞)
2831
f1(t) = t / (1 - t^2)
32+
# [0, 1] ↦ [-1, 1]
2933
f2(t) = 2t - 1
34+
# Compose the two transforms
3035
f = f1 f2
3136
return plane(f(t1), f(t2))
3237
end

src/specializations/Ray.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ function integral(
1414
rule::IntegrationRule;
1515
kwargs...
1616
)
17+
# Generate a _ParametricGeometry whose parametric function spans the domain [0, 1]
1718
paramfunction(t) = _parametric(ray, t)
18-
param_ray = _ParametricGeometry(paramfunction, 1)
19+
20+
# Integrate the _ParametricGeometry using the standard methods
1921
return _integral(f, param_ray, rule; kwargs...)
2022
end
2123

2224
############################################################################################
2325
# Parametric
2426
############################################################################################
2527

26-
# Map [0, 1] [0, ∞)
28+
# Map argument domain from [0, 1] to [0, ∞) for (::Ray)(t)
2729
function _parametric(ray::Meshes.Ray, t)
2830
f(t) = t / (1 - t^2)
2931
return ray(f(t))

0 commit comments

Comments
 (0)