Meshes.jl
Meshes.jl copied to clipboard
Add parameterization function to `Cylinder`
Summary
- Adds a parameterization function to
Cylinder
that works for cylinders with non-parallel top and bottom planes - Adds a helper function to inspect a
Cylinder
and determine whether its top and bottom planes will intersect - Updates the
axis(::Cylinder)
method to produce the desiredLine
directly, rather than transform theCylinder
into aCylinderSurface
and then run the same code on that.
Feel free to change the name of the helper function if you can think of a better one.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 88.14%. Comparing base (
5a287b6
) to head (fa20245
).
Additional details and impacted files
@@ Coverage Diff @@
## master #804 +/- ##
==========================================
+ Coverage 88.09% 88.14% +0.05%
==========================================
Files 164 164
Lines 4762 4783 +21
==========================================
+ Hits 4195 4216 +21
Misses 567 567
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I just updated the tests to address the line that Codecov reported as missing coverage, plus a couple of other lines in the same file. Two of these new tests involving constructing a Cylinder
with tuples instead of Point
s currently fail. This seems like maybe a type issue where one is defaulting to Float64
vs Float32
, but my first attempt at addressing that didn't work. I'll take another look at it tomorrow, but might just need to drop that change from this PR if I can't resolve quickly since it's not central to this PR's focus, just a nice-to-have while I was already adding tests for this source file.
We adopted a convention in which the methods are implemented in the *Surface
type when possible to avoid code repetition. In that sense, we should implement the methods in CylinderSurface
and call in Cylinder
.
To check whether the top and bottom planes intersect, we can
intersectsplanes(c) = isnothing(c.top ∩ c.bot) && radius_check
where radius_check
is the one involving the distance to the cylinder axis.
To check whether the top and bottom planes intersect, we can
intersectsplanes(c) = isnothing(c.top ∩ c.bot) && radius_check
where
radius_check
is the one involving the distance to the cylinder axis.
I'm not sure I'm following this exactly. How about I split the functionality into something like
-
intersectradius(c)
which yields the radius at which the intersection occurs (Inf
if planes are parallel) -
hasintersectingplanes(c) = c.radius > intersectradius(c)
to determine whether the planes do intersect for this cylinder
~~Are you able to re-trigger the CI run @juliohm? Looks like the tests all pass, but 3 of the CI runs seem to have just failed to run at all with no error output.~~ I believe this PR is otherwise good-to-go pending any feedback you might have.
Hi @mikeingold , added you to the meshes team so that you can re-trigger these bots in the future.
If the tests pass here, we can go ahead and merge.