Skip to content

SUGGESTION - "High level" command to sweep 2d (or 3d?) shape along a path #9518

Description

@Jimw338

Sorry for length. Could CGAL implement a “Sweep” command (idea from old Super3D program for Macintosh), like OpenSCAD’s linear_extrude, except that would use a custom path?

I’m a complete newbie to CGAL, so I don’t know if there’s a specific place suggestions should go, or if this has been suggested, hashed out, and rejected for some (good) reason before.

I read somewhere about OpenSCAD that “if CGAL doesn’t have it then OpenSCAD doesn’t (natively)”. Hence this suggestion, or the theory that implementing it at the level of CGAL could be more efficient than OpenSCAD.

I don’t know if CGAL (or OpenSCD) can implement “paths” as pure 1D structures (rather than just “very thin 2D “snakes”). The geometry would presumably be something like the following (pseudo-HyperTalk):

On Sweep (shape3D, path)
pPlane[0] = perpendicular to first segment of path
newShape[0] = shape3D

repeat for segments t along the path
	determine perpendicular plane to t -> pPlane[0]
	determine “average direction” of segment t -> d

	replicate newShape in direction d -> newShape[1]
	rotate newShape[1] pPlane[0] to pPlane[1]
	extrude newShape[1] if newShape[0] is 2D
	render newShape[1]

	pPlane[1] -> pPlane[0]
	newShape[1] -> newShape[0]
end repeat
End sweep

This would be relatively easy to implement in OpenSCAD - I’d have to figure out how to do find the direction and perpendicular from the triangle strip, and how to calculate the segment positions in that strip.

A further idea would be a scale function for each segment based on the “width” of the “snake” (length of chord across segment in direction pPlane[0])

Or does CGAL already have something like this, that OpenSCAD just doesn’t expose?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions