pub trait ProximityService:
Send
+ Sync
+ 'static {
// Required methods
fn bounds(&self, object: &ObjectId) -> Result<ObjectBounds, ProximityError>;
fn measure_proximity(
&self,
request: &ProximityRequest,
) -> Result<ProximityEvidence, ProximityError>;
// Provided methods
fn measure_distance(
&self,
request: &ProximityRequest,
) -> Result<ProjectedDistanceEvidence, ProximityError> { ... }
fn measure_face_distance(
&self,
request: &FaceDistanceRequest,
) -> Result<FaceDistanceEvidence, FaceDistanceError> { ... }
fn measure_region_distance(
&self,
request: &RegionDistanceRequest,
) -> Result<RegionDistanceEvidence, ProximityError> { ... }
fn measure_overlap_along(
&self,
request: &OverlapAlongRequest,
) -> Result<OverlapAlongEvidence, ProximityError> { ... }
fn measure_body_volume(
&self,
object: &ObjectId,
) -> Result<BodyVolume, ProximityError> { ... }
}Expand description
Measures extents and pairwise proximity of model objects.
ADR 0004: every method returns a measurement. None decides a clash.
Required Methods§
Sourcefn bounds(&self, object: &ObjectId) -> Result<ObjectBounds, ProximityError>
fn bounds(&self, object: &ObjectId) -> Result<ObjectBounds, ProximityError>
The extent of one object’s measured geometry.
Sourcefn measure_proximity(
&self,
request: &ProximityRequest,
) -> Result<ProximityEvidence, ProximityError>
fn measure_proximity( &self, request: &ProximityRequest, ) -> Result<ProximityEvidence, ProximityError>
How close two objects come and how far they overlap, in space.
A request in any other projection is refused with
ProximityError::UnsupportedProjection.
Provided Methods§
Sourcefn measure_distance(
&self,
request: &ProximityRequest,
) -> Result<ProjectedDistanceEvidence, ProximityError>
fn measure_distance( &self, request: &ProximityRequest, ) -> Result<ProjectedDistanceEvidence, ProximityError>
The distance between two objects in the request’s projection.
The default answers ProximityProjection::Minimum3d from
Self::measure_proximity and refuses every other projection, so a
service that does not measure projections fails closed.
Sourcefn measure_face_distance(
&self,
request: &FaceDistanceRequest,
) -> Result<FaceDistanceEvidence, FaceDistanceError>
fn measure_face_distance( &self, request: &FaceDistanceRequest, ) -> Result<FaceDistanceEvidence, FaceDistanceError>
The signed distance from one body to a class of another’s faces.
The default refuses with FaceDistanceError::Unsupported, so a
service that does not measure face distances fails closed.
Sourcefn measure_region_distance(
&self,
request: &RegionDistanceRequest,
) -> Result<RegionDistanceEvidence, ProximityError>
fn measure_region_distance( &self, request: &RegionDistanceRequest, ) -> Result<RegionDistanceEvidence, ProximityError>
The plan distance from a stated region to an object’s footprint.
The default refuses with ProximityError::UnsupportedProjection,
so a service that does not measure regions fails closed.
Sourcefn measure_overlap_along(
&self,
request: &OverlapAlongRequest,
) -> Result<OverlapAlongEvidence, ProximityError>
fn measure_overlap_along( &self, request: &OverlapAlongRequest, ) -> Result<OverlapAlongEvidence, ProximityError>
The extents of two bodies’ intersection along stated directions.
The default refuses with ProximityError::UnsupportedProjection,
so a service that does not measure them fails closed.
Sourcefn measure_body_volume(
&self,
object: &ObjectId,
) -> Result<BodyVolume, ProximityError>
fn measure_body_volume( &self, object: &ObjectId, ) -> Result<BodyVolume, ProximityError>
The volume one closed body encloses.
The default refuses with ProximityError::Unavailable, so a
service that does not measure volumes fails closed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".