geospatial icon indicating copy to clipboard operation
geospatial copied to clipboard

Add more advanced transform functions to geobase

Open navispatial opened this issue 2 years ago • 1 comments

The base sub library of the geocore package defines transform:

/// A function to transform the [source] point of [T] to a point of [T].
///
/// Target points of [T] are created using [source] itself as a point factory.
///
/// Throws FormatException if cannot transform.
typedef TransformPoint = T Function<T extends Point>(T source);

See also #15 for reference.

Currently there are only very basic transform-functions (on coordinates sub library):

/// Returns a function to translate points by delta values of each axis.
///
/// Set optional [dx], [dy], [dz] and [dm] values for translating on a
/// corresponding axis.
///
/// If a point to be translated do not have an axis even if a translation delta
/// for that axis is given, then such delta is ignored.
TransformPoint translatePoint<C extends num>({
  C? dx,
  C? dy,
  C? dz,
  C? dm,
});

/// Returns a function to scale points by scale factors for each axis.
///
/// Set optional [sx], [sy], [sz] and [sm] scale factors for scaling on a
/// corresponding axis.
///
/// If a point to be scaled do not have an axis even if a scale factor
/// for that axis is given, then such factor is ignored.
TransformPoint scalePoint<C extends num>;

/// Returns a function to scale points by the [scale] factor.
TransformPoint scalePointBy<C extends num>(C scale);

/// Returns a function to rotate points by the [radians] around the origin.
///
/// If both [cx] and [cy] are given then rotate points around this pivot point.
TransformPoint rotatePoint2D(num radians, {num? cx, num? cy});

Add more advanced transform functions too.

navispatial avatar Jan 14 '22 20:01 navispatial

These functions actually are in geobase not in geocore.

navispatial avatar Aug 06 '22 15:08 navispatial