Skip to content

feat: add in-memory GenericVisualization3D helper#5669

Open
baraafanah21 wants to merge 1 commit into
acts-project:mainfrom
baraafanah21:feature/5615-generic-visualization
Open

feat: add in-memory GenericVisualization3D helper#5669
baraafanah21 wants to merge 1 commit into
acts-project:mainfrom
baraafanah21:feature/5615-generic-visualization

Conversation

@baraafanah21

Copy link
Copy Markdown

Adds GenericVisualization3D, an 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 #5615. The collected data is exposed through
vertices() / faces() / lines() accessors so it can be handed to
external 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 of ObjVisualization3D exactly
    (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 end
    points 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, documented
    as "not a serialization format"; object(name) is a no-op like in
    PlyVisualization3D.
  • No changes to IVisualization3D or any existing implementation.

Testing

  • Structural unit tests for every interface method.
  • A cross-validation test draws the same surfaces (rectangle plane, full
    cylinder, sectoral cone — same parameters as the existing
    SurfaceView3DBase tests) with both ObjVisualization3D and
    GenericVisualization3D via GeometryView3D::drawSurface, parses the obj
    output, and checks the collected data element-for-element: vertex
    positions, face index lists, line endpoints, and colors.
  • Full unit test suite: 261/261 locally.

Open questions for reviewers

  1. Naming: the issue calls the class GenericVisualization; I used the
    3D suffix for consistency with ObjVisualization3D/PlyVisualization3D.
    Happy to rename if you prefer.
  2. faces() accessor vs virtual overload: the zero-argument faces()
    accessor overloads the three-argument virtual IVisualization3D::faces().
    Can rename to getVertices() / getFaces() / getLines() if preferred.
  3. line() vertex injection: flagging the choice above in case
    Obj-identical behavior is preferred.

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.
@github-actions github-actions Bot added the Component - Core Affects the Core module label Jul 11, 2026
@github-actions github-actions Bot added this to the next milestone Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component - Core Affects the Core module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant