-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1950 from hannobraun/curve
Add `Curve` object
- Loading branch information
Showing
16 changed files
with
98 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use fj_math::Transform; | ||
|
||
use crate::{objects::Curve, services::Services}; | ||
|
||
use super::{TransformCache, TransformObject}; | ||
|
||
impl TransformObject for Curve { | ||
fn transform_with_cache( | ||
self, | ||
_: &Transform, | ||
_: &mut Services, | ||
_: &mut TransformCache, | ||
) -> Self { | ||
// There's nothing to actually transform here, as `Curve` holds no data. | ||
// We still need this implementation though, as a new `Curve` object | ||
// must be created to represent the new and transformed curve. | ||
Self::new() | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
//! API for transforming objects | ||
mod curve; | ||
mod cycle; | ||
mod edge; | ||
mod face; | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/// A curve | ||
/// | ||
/// `Curve` represents a curve in space, but holds no data to define that curve. | ||
/// It is referenced by [`HalfEdge`], which defines the curve in the coordinates | ||
/// of its surface. | ||
/// | ||
/// `Curve` exists to allow identifying which [`HalfEdge`]s are supposed to be | ||
/// coincident in global space. | ||
/// | ||
/// # Equality | ||
/// | ||
/// `Curve` contains no data and exists purely to be used within a `Handle`, | ||
/// where `Handle::id` can be used to compare different instances of `Curve`. | ||
/// | ||
/// If `Curve` had `Eq`/`PartialEq` implementations, it containing no data would | ||
/// mean that all instances of `Curve` would be considered equal. This would be | ||
/// very error-prone. | ||
/// | ||
/// If you need to reference a `Curve` from a struct that needs to derive | ||
/// `Eq`/`Ord`/..., you can use `HandleWrapper<Curve>` to do that. It will use | ||
/// `Handle::id` to provide those `Eq`/`Ord`/... implementations. | ||
/// | ||
/// [`HalfEdge`]: crate::objects::HalfEdge | ||
#[derive(Clone, Debug, Default, Hash)] | ||
pub struct Curve {} | ||
|
||
impl Curve { | ||
/// Create a new instance | ||
pub fn new() -> Self { | ||
Self::default() | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod curve; | ||
pub mod cycle; | ||
pub mod edge; | ||
pub mod face; | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use crate::objects::Curve; | ||
|
||
use super::{Validate, ValidationConfig, ValidationError}; | ||
|
||
impl Validate for Curve { | ||
fn validate_with_config( | ||
&self, | ||
_: &ValidationConfig, | ||
_: &mut Vec<ValidationError>, | ||
) { | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
//! Infrastructure for validating objects | ||
mod curve; | ||
mod cycle; | ||
mod edge; | ||
mod face; | ||
|