pub struct SurfaceSurfaceIntersection { /* private fields */ }Expand description
The intersection of two surfaces.
Read it through curves,
contact_points,
is_coincident, method,
completeness,
is_complete and is_empty.
Intersect::intersect returns it.
§Examples
use geomcore::{Intersect, IntersectionMethod, Plane, Point, Sphere, Tolerance, Vector};
// The plane z = 1 cuts a sphere of radius 2 in one circle.
let plane = Plane::new(Point::new(0.0, 0.0, 1.0), Vector::Z).unwrap();
let sphere = Sphere::new(Point::ORIGIN, 2.0).unwrap();
let result = plane.intersect(&sphere, Tolerance::DEFAULT);
assert_eq!(result.method(), IntersectionMethod::Exact);
assert!(result.is_complete() && !result.is_empty());
assert_eq!(result.curves().len(), 1);
assert!(!result.curves()[0].tangent);
assert!(result.contact_points().is_empty());
assert!(!result.is_coincident());Implementations§
Source§impl SurfaceSurfaceIntersection
impl SurfaceSurfaceIntersection
Sourcepub fn curves(&self) -> &[IntersectionCurve]
pub fn curves(&self) -> &[IntersectionCurve]
The curves along which the surfaces meet.
§Examples
use geomcore::{Intersect, Plane, Point, Sphere, Tolerance, Vector};
let plane = Plane::new(Point::new(0.0, 0.0, 1.0), Vector::Z).unwrap();
let sphere = Sphere::new(Point::ORIGIN, 2.0).unwrap();
let result = plane.intersect(&sphere, Tolerance::DEFAULT);
assert_eq!(result.curves().len(), 1);Sourcepub fn contact_points(&self) -> &[Point]
pub fn contact_points(&self) -> &[Point]
The isolated points where the surfaces touch. On the numeric path, the points where marching found them touching without a curve of contact running on.
§Examples
use geomcore::{Intersect, Plane, Point, Sphere, Tolerance, Vector};
let plane = Plane::new(Point::new(0.0, 0.0, 2.0), Vector::Z).unwrap();
let sphere = Sphere::new(Point::ORIGIN, 2.0).unwrap();
let result = plane.intersect(&sphere, Tolerance::DEFAULT);
// Tangent at the north pole.
assert_eq!(result.contact_points().len(), 1);Sourcepub fn is_coincident(&self) -> bool
pub fn is_coincident(&self) -> bool
Whether the surfaces are the same surface.
On the numeric path this is found from samples: every sample of
each surface lies on the other, with the normals parallel. The
completeness is then Completeness::Sampled. Where only one
surface lies on the other (a patch on its whole surface), the
result is not coincident but
Incomplete, with a region covering
the patch.
§Examples
use geomcore::{Intersect, Plane, Point, Sphere, Tolerance, Vector};
let plane = Plane::new(Point::new(0.0, 0.0, 1.0), Vector::Z).unwrap();
let sphere = Sphere::new(Point::ORIGIN, 2.0).unwrap();
let result = plane.intersect(&sphere, Tolerance::DEFAULT);
assert!(!result.is_coincident());
// A sphere against its own B-spline form, found numerically.
let copy = sphere.to_bspline();
let result = sphere.intersect(©, Tolerance::DEFAULT);
assert!(result.is_coincident() && result.curves().is_empty());
assert_eq!(result.completeness(), &geomcore::Completeness::Sampled);Sourcepub fn method(&self) -> IntersectionMethod
pub fn method(&self) -> IntersectionMethod
Whether the result came from a closed form or a numeric search.
§Examples
use geomcore::{Intersect, Plane, Point, Sphere, Tolerance, Vector};
let plane = Plane::new(Point::new(0.0, 0.0, 1.0), Vector::Z).unwrap();
let sphere = Sphere::new(Point::ORIGIN, 2.0).unwrap();
let result = plane.intersect(&sphere, Tolerance::DEFAULT);
assert_eq!(result.method(), geomcore::IntersectionMethod::Exact);Sourcepub fn completeness(&self) -> &Completeness<SurfaceSurfaceRegion>
pub fn completeness(&self) -> &Completeness<SurfaceSurfaceRegion>
Whether every piece was found, and where some may be missing if not.
§Examples
use geomcore::{Intersect, Plane, Point, Sphere, Tolerance, Vector};
let plane = Plane::new(Point::new(0.0, 0.0, 1.0), Vector::Z).unwrap();
let sphere = Sphere::new(Point::ORIGIN, 2.0).unwrap();
let result = plane.intersect(&sphere, Tolerance::DEFAULT);
assert_eq!(result.completeness(), &geomcore::Completeness::Complete);Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Whether every piece was found.
§Examples
use geomcore::{Intersect, Plane, Point, Sphere, Tolerance, Vector};
let plane = Plane::new(Point::new(0.0, 0.0, 1.0), Vector::Z).unwrap();
let sphere = Sphere::new(Point::ORIGIN, 2.0).unwrap();
let result = plane.intersect(&sphere, Tolerance::DEFAULT);
assert!(result.is_complete());Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether there is no curve, no contact point and no coincidence. With an incomplete result this means “found nothing”, not “nothing exists”.
§Examples
use geomcore::{Intersect, Plane, Point, Sphere, Tolerance, Vector};
let plane = Plane::new(Point::new(0.0, 0.0, 5.0), Vector::Z).unwrap();
let sphere = Sphere::new(Point::ORIGIN, 2.0).unwrap();
let result = plane.intersect(&sphere, Tolerance::DEFAULT);
assert!(result.is_empty());