Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

project to plane #587

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions modeling-cmds/src/def_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,19 @@
pub curve_id: Uuid,
}

/// Project an entity on to a plane.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could use a bit more detail or an example of its use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

An example or in the comments of the endpoint? Projecting a point onto a plane is where you calculate the normal between a plane and a point that does not lie on the plane. You then move that point along the normal until it is now lying on the plane exactly.

Useful for constraints, shadows, intersection testing, etc.p

#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]

Check warning on line 813 in modeling-cmds/src/def_enum.rs

View check run for this annotation

Codecov / codecov/patch

modeling-cmds/src/def_enum.rs#L813

Added line #L813 was not covered by tests
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add PartialEq and ts-rs derives like in #708 before merging.

pub struct ProjectEntityToPlane {
/// Which entity to project (vertex or edge).
pub entity_id: Uuid,
/// Which plane to project entity_id onto.
pub plane_id: Uuid,
/// If true: the projected points are returned in the plane_id's coordinate system,
/// else: the projected points are returned in the world coordinate system.
pub use_plane_coords: bool,

}

/// Enum containing the variety of image formats snapshots may be exported to.
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, FromStr, Display)]
#[serde(rename_all = "snake_case")]
Expand Down
7 changes: 7 additions & 0 deletions modeling-cmds/src/ok_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,13 @@
pub control_points: Vec<Point3d<f64>>,
}

/// The response from the `ProjectEntityToPlane` command.
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]

Check warning on line 477 in modeling-cmds/src/ok_response.rs

View check run for this annotation

Codecov / codecov/patch

modeling-cmds/src/ok_response.rs#L477

Added line #L477 was not covered by tests
pub struct ProjectEntityToPlane {
/// Projected points.
pub projected_points: Vec<Point3d<f64>>,
}

/// The response from the `CurveGetType` command.
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, Eq, PartialEq, ModelingCmdOutput)]
pub struct CurveGetType {
Expand Down
Loading