truncated - multiple declarations
Function truncated
Returns a point with each fractional coordinate part removed.
This operation is available only for floating-point geometry. Finite coordinates are rounded toward zero and the original scalar type is retained. NaN and infinities remain non-finite floating-point values; signed zero is preserved.
No allocation is performed.
Complexity
O(1) time and O(1) auxiliary space.
Function truncated
Returns a vector with each fractional component removed.
This operation is available only for floating-point geometry. Finite components are rounded toward zero and the original scalar type is retained. NaN and infinities remain non-finite floating-point values; signed zero is preserved.
No allocation is performed.
Complexity
O(1) time and O(1) auxiliary space.
Example
Example removing fractional parts toward zero.
import geo;
const point =
Point2!double(
1.75,
-2.25
);
const vector =
Vector2!double(
-1.25,
2.75
);
assert(
point .truncated ==
Point2!double(
1.0,
-2.0
)
);
assert(
vector .truncated ==
Vector2!double(
-1.0,
2.0
)
);