feat: add in-memory GenericVisualization3D helper#5669
Open
baraafanah21 wants to merge 1 commit into
Open
Conversation
Add a new IVisualization3D implementation that collects vertices, faces and lines in memory instead of writing them to a file, as a first step towards the centralized python displaying infrastructure outlined in acts-project#5615. The collected data is exposed through accessors so it can be handed to external plotting backends. The faces() semantics mirror ObjVisualization3D, which is verified by a unit test that draws identical surfaces with both helpers and compares the collected data against the parsed obj output. Part of acts-project#5615. PR 1 of 3 - pybind11 bindings and a matplotlib backend to follow in subsequent PRs.
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.
Adds
GenericVisualization3D, anIVisualization3Dimplementation thatcollects vertices, faces and lines in memory instead of writing them to a
file, as a first step towards the centralized python displaying
infrastructure outlined in #5615. The collected data is exposed through
vertices()/faces()/lines()accessors so it can be handed toexternal plotting backends.
Part of #5615 (step 1 of 3 in the workplan there — pybind11 bindings and
a matplotlib backend will follow in separate PRs to keep review manageable).
--- END COMMIT MESSAGE ---
Approach
face()/faces()mirror the semantics ofObjVisualization3Dexactly(bulk vertex insert, two-index faces stored as lines, index offsets), so
the in-memory data matches what the obj writer would produce for the same
drawing calls.
line()stores a self-contained point pair and does not append its endpoints to the vertex collection — appending them is an OBJ/PLY file-format
artifact rather than intended semantics. Happy to change if you prefer
strict Obj behavior.
write(ostream)/write(path)emit a one-line debug summary, documentedas "not a serialization format";
object(name)is a no-op like inPlyVisualization3D.IVisualization3Dor any existing implementation.Testing
cylinder, sectoral cone — same parameters as the existing
SurfaceView3DBasetests) with bothObjVisualization3DandGenericVisualization3DviaGeometryView3D::drawSurface, parses the objoutput, and checks the collected data element-for-element: vertex
positions, face index lists, line endpoints, and colors.
Open questions for reviewers
GenericVisualization; I used the3Dsuffix for consistency withObjVisualization3D/PlyVisualization3D.Happy to rename if you prefer.
faces()accessor vs virtual overload: the zero-argumentfaces()accessor overloads the three-argument virtual
IVisualization3D::faces().Can rename to
getVertices()/getFaces()/getLines()if preferred.line()vertex injection: flagging the choice above in caseObj-identical behavior is preferred.