getPathOBB method

AABB getPathOBB()

Implementation

AABB getPathOBB() {
  double minX = double.maxFinite;
  double minY = double.maxFinite;
  double maxX = -double.maxFinite;
  double maxY = -double.maxFinite;

  List<PathPoint> renderPoints = points;
  for (final PathPoint point in renderPoints) {
    Vec2D t = point.translation;
    double x = t[0];
    double y = t[1];
    if (x < minX) {
      minX = x;
    }
    if (y < minY) {
      minY = y;
    }
    if (x > maxX) {
      maxX = x;
    }
    if (y > maxY) {
      maxY = y;
    }

    if (point is CubicPathPoint) {
      Vec2D t = point.inPoint;
      x = t[0];
      y = t[1];
      if (x < minX) {
        minX = x;
      }
      if (y < minY) {
        minY = y;
      }
      if (x > maxX) {
        maxX = x;
      }
      if (y > maxY) {
        maxY = y;
      }

      t = point.outPoint;
      x = t[0];
      y = t[1];
      if (x < minX) {
        minX = x;
      }
      if (y < minY) {
        minY = y;
      }
      if (x > maxX) {
        maxX = x;
      }
      if (y > maxY) {
        maxY = y;
      }
    }
  }

  return AABB.fromValues(minX, minY, maxX, maxY);
}