mirror of
https://github.com/hannobraun/Fornjot
synced 2025-06-28 14:16:07 +00:00
Reference Curve
from HalfEdge
The intention is to eventually replace `GlobalEdge`.
This commit is contained in:
parent
bbfd1a5e50
commit
a849efa3db
@ -18,6 +18,10 @@ impl TransformObject for HalfEdge {
|
||||
// coordinates.
|
||||
let path = self.path();
|
||||
let boundary = self.boundary();
|
||||
let curve = self
|
||||
.curve()
|
||||
.clone()
|
||||
.transform_with_cache(transform, services, cache);
|
||||
let start_vertex = self
|
||||
.start_vertex()
|
||||
.clone()
|
||||
@ -27,7 +31,7 @@ impl TransformObject for HalfEdge {
|
||||
.clone()
|
||||
.transform_with_cache(transform, services, cache);
|
||||
|
||||
Self::new(path, boundary, start_vertex, global_form)
|
||||
Self::new(path, boundary, curve, start_vertex, global_form)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ use fj_math::Point;
|
||||
|
||||
use crate::{
|
||||
geometry::{BoundaryOnCurve, SurfacePath},
|
||||
objects::Vertex,
|
||||
objects::{Curve, Vertex},
|
||||
storage::{Handle, HandleWrapper},
|
||||
};
|
||||
|
||||
@ -42,6 +42,7 @@ use crate::{
|
||||
pub struct HalfEdge {
|
||||
path: SurfacePath,
|
||||
boundary: BoundaryOnCurve,
|
||||
curve: HandleWrapper<Curve>,
|
||||
start_vertex: HandleWrapper<Vertex>,
|
||||
global_form: HandleWrapper<GlobalEdge>,
|
||||
}
|
||||
@ -51,12 +52,14 @@ impl HalfEdge {
|
||||
pub fn new(
|
||||
path: SurfacePath,
|
||||
boundary: impl Into<BoundaryOnCurve>,
|
||||
curve: Handle<Curve>,
|
||||
start_vertex: Handle<Vertex>,
|
||||
global_form: Handle<GlobalEdge>,
|
||||
) -> Self {
|
||||
Self {
|
||||
path,
|
||||
boundary: boundary.into(),
|
||||
curve: curve.into(),
|
||||
start_vertex: start_vertex.into(),
|
||||
global_form: global_form.into(),
|
||||
}
|
||||
@ -82,6 +85,11 @@ impl HalfEdge {
|
||||
self.path.point_from_path_coords(start)
|
||||
}
|
||||
|
||||
/// Access the curve of the half-edge
|
||||
pub fn curve(&self) -> &Handle<Curve> {
|
||||
&self.curve
|
||||
}
|
||||
|
||||
/// Access the vertex from where this half-edge starts
|
||||
pub fn start_vertex(&self) -> &Handle<Vertex> {
|
||||
&self.start_vertex
|
||||
|
@ -3,7 +3,7 @@ use fj_math::{Arc, Point, Scalar};
|
||||
|
||||
use crate::{
|
||||
geometry::{BoundaryOnCurve, SurfacePath},
|
||||
objects::{GlobalEdge, HalfEdge, Vertex},
|
||||
objects::{Curve, GlobalEdge, HalfEdge, Vertex},
|
||||
operations::Insert,
|
||||
services::Services,
|
||||
};
|
||||
@ -16,10 +16,11 @@ pub trait BuildHalfEdge {
|
||||
boundary: impl Into<BoundaryOnCurve>,
|
||||
services: &mut Services,
|
||||
) -> HalfEdge {
|
||||
let curve = Curve::new().insert(services);
|
||||
let start_vertex = Vertex::new().insert(services);
|
||||
let global_form = GlobalEdge::new().insert(services);
|
||||
|
||||
HalfEdge::new(path, boundary, start_vertex, global_form)
|
||||
HalfEdge::new(path, boundary, curve, start_vertex, global_form)
|
||||
}
|
||||
|
||||
/// Create an arc
|
||||
|
@ -14,6 +14,7 @@ impl Reverse for Cycle {
|
||||
HalfEdge::new(
|
||||
current.path(),
|
||||
current.boundary().reverse(),
|
||||
current.curve().clone(),
|
||||
next.start_vertex().clone(),
|
||||
current.global_form().clone(),
|
||||
)
|
||||
|
@ -19,6 +19,7 @@ impl UpdateHalfEdge for HalfEdge {
|
||||
HalfEdge::new(
|
||||
self.path(),
|
||||
self.boundary(),
|
||||
self.curve().clone(),
|
||||
start_vertex,
|
||||
self.global_form().clone(),
|
||||
)
|
||||
@ -28,6 +29,7 @@ impl UpdateHalfEdge for HalfEdge {
|
||||
HalfEdge::new(
|
||||
self.path(),
|
||||
self.boundary(),
|
||||
self.curve().clone(),
|
||||
self.start_vertex().clone(),
|
||||
global_form,
|
||||
)
|
||||
|
@ -95,6 +95,7 @@ mod tests {
|
||||
HalfEdge::new(
|
||||
valid.path(),
|
||||
boundary,
|
||||
valid.curve().clone(),
|
||||
valid.start_vertex().clone(),
|
||||
valid.global_form().clone(),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user