cartesianToCylindrical property

List<List<num>> cartesianToCylindrical

Converts a list of Cartesian coordinates to a list of Polar Spherical coordinates:

  • [x, y, z] -> [rho, phi, z],
  • rho is the radius.
  • phi is azimuth in rad taking values 0...2*pi.

Implementation

List<List<num>> get cartesianToCylindrical {
  try {
    return List<List<num>>.generate(
        length, (index) => this[index].cartesianToCylindrical);
  } on RangeError catch (e, _) {
    throw ErrorOfType<IndexOutOfRange>(
        message: 'Error in getter <cartesianToCylindrical>.',
        invalidState: 'Could not access list '
            'element with index:<${e.invalidValue}>.',
        expectedState: 'A set of coordinates as a List<num> with length 3.');
  }
}