New shapes: Line and Line2D#383
Merged
Merged
Conversation
JLeliaert
requested changes
Mar 16, 2026
JLeliaert
left a comment
Contributor
There was a problem hiding this comment.
The default value for the line cap is 0, which returns an error message
type mismatch: can not use type int as string
Contributor
When the line goes exactly through the corner, single precision leads to situations where a cell that should be selected is not, so that the geometry is no longer a face-connected set but is missing a "bridge" cell between two corner-connected cells. |
ilateur
approved these changes
Mar 17, 2026
JLeliaert
approved these changes
Mar 18, 2026
ilateur
requested changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


As suggested by @Mat1629, this PR adds two new shapes to create lines. This can be convenient for, e.g., defining 3D ASI structures.
Line(x1, y1, z1, x2, y2, z2, diam, linecap)generates a line fromdiam. The behavior of the line at these two endpoints is determined by the last argumentlinecap, which can be"infinite": the line extends indefinitely beyond the two specified points."round": a sphere of radiusdiamis placed at the two endpoints, yielding a smooth shape."flat": the line stops abruptly at the two endpoints in a flat plane perpendicular to the line.Line2D(x1, y1, x2, y2, diam, linecap)behaves the same, but extends indefinitely along the Z-axis. Hence, this basically creates a plane in 3D space whose normal vector always lies in the XY-plane.A special case was implemented for
diam=0, in which case the shape will be a minimally connected geometry of all cells intersected by the line.Warning
If a
diam=0line is scaled or rotated afterwards, it is no longer guaranteed that this shape is fully connected, since the shape function then has no way of knowing what cells it would eventually intersect.Visual examples
Below are some geometries from
test/line.mx3(but after an additionalrelax()).LineLine2D"round""flat""infinite""infinite"withdiam=0