Point.build constructor
Builds a point geometry from a position
.
Use an optional type
to explicitely specify the type of coordinates. If
not provided and an iterable has 3 items, then xyz coordinates are
assumed.
Supported coordinate value combinations for Iterable<double>
are:
(x, y), (x, y, z), (x, y, m) and (x, y, z, m).
Examples:
// a point with a 2D position (x: 10.0, y: 20.0)
Point.build([10.0, 20.0]);
// a point with a 3D position (x: 10.0, y: 20.0, z: 30.0)
Point.build([10.0, 20.0, 30.0]);
// a point with a measured 2D position (x: 10.0, y: 20.0, m: 40.0)
// (need to specify the coordinate type XYM)
Point.build([10.0, 20.0, 40.0], type: Coords.xym);
// a point with a measured 3D position
// (x: 10.0, y: 20.0, z: 30.0, m: 40.0)
Point.build([10.0, 20.0, 30.0, 40.0]);
Implementation
factory Point.build(
Iterable<double> position, {
Coords? type,
}) =>
Point(
Position.view(
// ensure list structure
position is List<double> ? position : toFloatNNList(position),
// resolve type if not known
type: type ?? Coords.fromDimension(position.length),
),
);