Skip to content

Metrology Module

Warning

The metrology feature set is still experimental and is under heavy development in the Rust engeom library. Expect significant changes to the API in the future.

This module contains classes which represent measurements, such as distances, angles, and GD&T features.

Distance2

Represents a distance between two points in 2D space.

a property

Get the first point in the distance calculation.

Returns:

Type Description
Point2

The first point

b property

Get the second point in the distance calculation.

Returns:

Type Description
Point2

The second point

center property

Get a center surface point, located halfway between the a and b points and with a normal facing the direction vector.

Returns:

Type Description
SurfacePoint2

the center surface point

direction property

Get the direction of the distance calculation.

Returns:

Type Description
Vector2

The direction vector

value property

Get the signed distance scalar value.

Returns:

Type Description
float

the signed distance

__init__(a, b, direction=None)

Initialize a new 2D distance object.

Parameters:

Name Type Description Default
a Point2

The first point in the distance calculation.

required
b Point2

The second point in the distance calculation.

required
direction Vector2 | None

The direction of the distance calculation. If not provided, the direction will be calculated automatically as the vector b - a.

None

to_3d(iso)

Convert this 2D distance to a 3D distance by adding a zero Z component to the points and direction and then transforming them using the provided isometry.

Parameters:

Name Type Description Default
iso Iso3

The isometry to transform the entity by after adding a zero Z component.

required

Returns:

Type Description
Distance3

The 3D distance object

Distance3

Represents a distance between two points in 3D space.

a property

Get the first point in the distance calculation.

Returns:

Type Description
Point3

The first point

b property

Get the second point in the distance calculation.

Returns:

Type Description
Point3

The second point

center property

Get a center surface point, located halfway between the a and b points and with a normal facing the direction vector.

Returns:

Type Description
SurfacePoint3

the center surface point

direction property

Get the direction of the distance calculation.

Returns:

Type Description
Vector3

The direction vector

value property

Get the signed distance scalar value.

Returns:

Type Description
float

the signed distance

__init__(a, b, direction=None)

Initialize a new 3D distance object.

Parameters:

Name Type Description Default
a Point3

The first point in the distance calculation.

required
b Point3

The second point in the distance calculation.

required
direction Vector3 | None

The direction of the distance calculation. If not provided, the direction will be calculated automatically as the vector b - a.

None

to_2d(iso)

Convert this 3D distance to a 2D distance by transforming the points and direction using the provided isometry and then removing the Z component.

Parameters:

Name Type Description Default
iso Iso3

The isometry to transform the entity by before removing the Z component.

required

Returns:

Type Description
Distance2

The 2D distance object