getArcCenter method

Vector3 getArcCenter()

Implementation

Vector3 getArcCenter() {
  var first4Points = points.take(4).toList();

  var a1 = first4Points[0];
  var h1 = first4Points[1];
  var h2 = first4Points[2];
  var a2 = first4Points[3];

  var t1 = h1 - a1;
  var t2 = h2 - a2;

  var n1 = t1.rotate(TAU / 4);
  var n2 = t2.rotate(TAU / 4);

  try {
    return lineIntersection(
      [a1, a1 + n1],
      [a2, a2 + n2],
    );
  } on Exception {
    print('Can\'t find Arc center, using ORIGIN instead');
    return ORIGIN;
  }
}