-
Notifications
You must be signed in to change notification settings - Fork 1
Added commands for object transforming (translate, rotate and scale) #441
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
Changes from 12 commits
afddc1a
3804508
31376c9
f618787
cf9c069
f74a5b2
fb0b02f
cc90921
88c7b23
1d8682e
876603c
cceca68
ff4a75e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -969,3 +969,57 @@ | |
| assert!(c >= a); | ||
| } | ||
| } | ||
|
|
||
| /// How a property of an object should be transformed. | ||
| #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize)] | ||
| #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] | ||
| #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] | ||
| pub struct TransformByPoint3d { | ||
| /// The scale, or rotation, or translation. | ||
| pub property: Point3d, | ||
| /// If true, overwrite the previous value with this. | ||
| /// If false, the previous value will be modified. | ||
| /// E.g. when translating, `set=true` will set a new location, | ||
| /// and `set=false` will translate the current location by the given X/Y/Z. | ||
| pub set: bool, | ||
| /// If true, the transform is applied in local space. | ||
| /// If false, the transform is applied in global space. | ||
| pub is_local: bool, | ||
| } | ||
|
|
||
| /// How a property of an object should be transformed. | ||
| /// This is a 4D version of the `TransformByPoint3d` (Used when wanting to specify a rotation with | ||
| /// an angle and axis instead of roll pitch yaw). | ||
| #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize)] | ||
| #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] | ||
| #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] | ||
| pub struct TransformByPoint4d { | ||
| /// The scale, or rotation, or translation. | ||
| pub property: Point4d, | ||
| /// If true, overwrite the previous value with this. | ||
| /// If false, the previous value will be modified. | ||
| /// E.g. when translating, `set=true` will set a new location, | ||
| /// and `set=false` will translate the current location by the given X/Y/Z. | ||
| pub set: bool, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this not the same as relative? If it is then should we not call this relative for consistency?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having said that, if the intention is for relative to be the default then maybe absolute is a better name.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. relative, absolute, override. There are many ways of describing this |
||
| /// If true, the transform is applied in local space. | ||
| /// If false, the transform is applied in global space. | ||
| pub is_local: bool, | ||
| } | ||
|
|
||
| /// Container that holds a translate, rotate and scale. | ||
| #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize)] | ||
| #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] | ||
| #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] | ||
| pub struct ComponentTransform { | ||
| /// Translate component of the transform. | ||
| pub translate: Option<TransformByPoint3d>, | ||
| /// Rotate component of the transform. | ||
| /// The rotation is specified as a roll, pitch, yaw. | ||
| pub rotate_rpy: Option<TransformByPoint3d>, | ||
| /// Rotate component of the transform. | ||
| /// The rotation is specified as an axis and an angle (xyz are the components of the axis, w is | ||
| /// the angle in degrees). | ||
| pub rotate_angle_axis: Option<TransformByPoint4d>, | ||
| /// Scale component of the transform. | ||
| pub scale: Option<TransformByPoint3d>, | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.