mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-15 03:35:52 +00:00
Use GlobalEdge
as approximation cache key
This commit is contained in:
parent
087401bf21
commit
e7d8b24b6b
@ -9,7 +9,7 @@ use std::collections::BTreeMap;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
geometry::path::{GlobalPath, SurfacePath},
|
geometry::path::{GlobalPath, SurfacePath},
|
||||||
objects::{Curve, GlobalCurve, HalfEdge, Surface},
|
objects::{Curve, GlobalEdge, HalfEdge, Surface},
|
||||||
storage::{Handle, ObjectId},
|
storage::{Handle, ObjectId},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ impl Approx for (&Handle<HalfEdge>, &Surface) {
|
|||||||
|
|
||||||
let curve_approx = {
|
let curve_approx = {
|
||||||
let global_curve_approx = match cache
|
let global_curve_approx = match cache
|
||||||
.get(half_edge.global_form().curve().clone(), range)
|
.get(half_edge.global_form().clone(), range)
|
||||||
{
|
{
|
||||||
Some(approx) => approx,
|
Some(approx) => approx,
|
||||||
None => {
|
None => {
|
||||||
@ -47,11 +47,7 @@ impl Approx for (&Handle<HalfEdge>, &Surface) {
|
|||||||
range,
|
range,
|
||||||
tolerance,
|
tolerance,
|
||||||
);
|
);
|
||||||
cache.insert(
|
cache.insert(half_edge.global_form().clone(), range, approx)
|
||||||
half_edge.global_form().curve().clone(),
|
|
||||||
range,
|
|
||||||
approx,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -193,7 +189,7 @@ impl CurveCache {
|
|||||||
/// Insert the approximation of a [`GlobalCurve`]
|
/// Insert the approximation of a [`GlobalCurve`]
|
||||||
pub fn insert(
|
pub fn insert(
|
||||||
&mut self,
|
&mut self,
|
||||||
handle: Handle<GlobalCurve>,
|
handle: Handle<GlobalEdge>,
|
||||||
range: RangeOnPath,
|
range: RangeOnPath,
|
||||||
approx: GlobalCurveApprox,
|
approx: GlobalCurveApprox,
|
||||||
) -> GlobalCurveApprox {
|
) -> GlobalCurveApprox {
|
||||||
@ -204,7 +200,7 @@ impl CurveCache {
|
|||||||
/// Access the approximation for the given [`GlobalCurve`], if available
|
/// Access the approximation for the given [`GlobalCurve`], if available
|
||||||
pub fn get(
|
pub fn get(
|
||||||
&self,
|
&self,
|
||||||
handle: Handle<GlobalCurve>,
|
handle: Handle<GlobalEdge>,
|
||||||
range: RangeOnPath,
|
range: RangeOnPath,
|
||||||
) -> Option<GlobalCurveApprox> {
|
) -> Option<GlobalCurveApprox> {
|
||||||
if let Some(approx) = self.inner.get(&(handle.id(), range)) {
|
if let Some(approx) = self.inner.get(&(handle.id(), range)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user