Skip to content

Define orthographic projection geometry and source provenance - #1459

Draft
franknoirot wants to merge 7 commits into
mainfrom
codex/drawing-projection-contract
Draft

franknoirot wants to merge 7 commits into
mainfrom
codex/drawing-projection-contract

Conversation

@franknoirot

@franknoirot franknoirot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Taking a stab at the protocol slice of the ZDS drawings prototype: define a read-only ComputeOrthographicProjection command so engine can return projected geometry for client rendering.

The reason I didn't include "Drawing" in the names is that I'd like for us to reuse these schemas when we turn our attention to implementing a "Project/Use" tool within sketches: that tool will use the same algorithms and very similar data. So the initial command projects one complete body; selected-edge/face inputs are deferred to a follow-up.

This is the contract for a paired extraction of alteous’s engine #4329. Let me know if PlanarFrame is a bad type. I was trying to follow her initial work and then tie its payload to @therapon's work on named views, which will need to be accepted as inputed into the to-be-made KCL functions for projections to be dropped into drawings.

TIL modeling-api doesn't have any struct definitions for like actual 2D segments. PathSegment::Line is kind of a misnomer: it's really a pen move, with an implicit start, not a segment at all.

@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.66667% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@039227b). Learn more about missing BASE report.

Files with missing lines Patch % Lines
modeling-cmds/src/def_enum.rs 95.23% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1459   +/-   ##
=======================================
  Coverage        ?   38.83%           
=======================================
  Files           ?       33           
  Lines           ?     1818           
  Branches        ?        0           
=======================================
  Hits            ?      706           
  Misses          ?     1112           
  Partials        ?        0           
Flag Coverage Δ
unittests 38.83% <98.66%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@franknoirot franknoirot changed the title Define drawing projection geometry and source provenance Define orthographic projection geometry and source provenance Oct 22, 2026
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct PlanarFrame {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't have anything similar already?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah I wondered the same thing at first. The camera view plane used for Named Views has other data for object visibility, and the base KCL plane has an engine scene entity which idk if this would; here's a table from Codex:

Type What it represents
Named view Camera intent plus object-visibility choices
KCL Plane An oriented plane with execution/artifact identity and potentially an engine scene object
PlanarFrame Just the origin and axes needed for the computation

Comment thread modeling-cmds/src/shared.rs Outdated
pub end_angle: f64,
/// Whether the arc advances counter-clockwise from start_angle to end_angle.
/// A full circle has an angular sweep of 2 pi; equal angles mean zero sweep.
pub counter_clockwise: bool,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd prefer for this to be more explicit:

enum Winding {
    #[default]
    Counterclockwise,
    Clockwise,
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct ComputeOrthographicProjection {
/// UUID of the BREP body to project. Other scene bodies do not occlude it.
pub object_id: Uuid,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like the data structures so far. I'm wondering whether a sole object ID is enough and what the ramifications are if we permit more than one.

If we consider assemblies, for example, we may want a projection of two distinct solids that are able to occlude each other. Returning one Vec<Curve> per solid (Vec<Vec<Curve>>) in ok_response::ComputeOrthographicProjection comes to mind.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh interesting. Would that be a breaking change if we were to add that later? I don't see an immediate need for that capability but it does seem cool

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