Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distance to Surface for Remaining Surface Primitives #159

Merged
merged 4 commits into from
May 17, 2021

Conversation

hervasa2
Copy link
Collaborator

distance_to_surface() added to RegularPolygon, RegularPrismMantle, and Rectangle
All are type stable, allocation free and have a worst case btime of ~50ns
rp = CSG.RegularPolygon(7,0.8,1.3,0)
Screen Shot 2021-05-17 at 8 30 51 PM
distance_to_regular_polygon

rpm = CSG.RegularPrismMantle(3,1.3,1)
Screen Shot 2021-05-17 at 8 31 54 PM
distance_to_regular_prism_mantle
distance_to_regular_prism_mantle2

rec = CSG.RectangleX(0.5, 1, -1.2, 0.6, 0)
Screen Shot 2021-05-17 at 8 33 53 PM
distance_to_rectangle
distance_to_rectangle2

rec = CSG.RectangleZ(0.5, 1, -1.2, 0.6, 0.5)
Screen Shot 2021-05-17 at 8 35 23 PM
distance_to_rectangle3

@hervasa2 hervasa2 requested a review from fhagemann May 17, 2021 18:42
Comment on lines 239 to 241
lMin::T, lMax::T = get_l_limits(r)
wMin::T, wMax::T = get_w_limits(r)
if l in lMin..lMax && w in wMin..wMax
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use existing internal functions (similar to _in_planar_u)?
If r.l and r.w are Intervals, we would determine the edges and create a "new" interval from them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 options.

  • _in_planar_u would work but then you have to create PlanarPoints
  • use multiple dispatch. This would be a lot of unnecessary code
  • leave as is. Creates new intervals.

All have drawbacks.

@fhagemann
Copy link
Collaborator

rp = CSG.RegularPolygon(7,0.8,1.3,0)
Screen Shot 2021-05-17 at 8 30 51 PM
distance_to_regular_polygon

Is this the same object? The cutout of the Polygon looks bigger in the GIF than in the figure...

Copy link
Collaborator

@fhagemann fhagemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good!

@fhagemann fhagemann merged commit 493ddc6 into JuliaPhysics:v0.6 May 17, 2021
@fhagemann fhagemann mentioned this pull request May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants