fromCoords<T extends Point<num> > static method
Bounds<T>
fromCoords<T extends Point<num> >(
- Iterable<
num> coords, { - required PointFactory<
T> pointFactory, - int? offset,
- int? length,
Creates Bounds from coords
using pointFactory
.
Implementation
static Bounds<T> fromCoords<T extends Point>(
Iterable<num> coords, {
required PointFactory<T> pointFactory,
int? offset,
int? length,
}) {
CoordinateFactory.checkCoords(4, coords, offset: offset, length: length);
final start = offset ?? 0;
final len = length ?? coords.length;
final pointLen = len ~/ 2;
return Bounds<T>.of(
min: pointFactory.newFrom(
coords,
offset: start,
length: pointLen,
),
max: pointFactory.newFrom(
coords,
offset: start + pointLen,
length: pointLen,
),
);
}