stackRectangle function

List<SdlxFPoint> stackRectangle(
  1. SdlxFPoint p1,
  2. SdlxFPoint p2
)

Implementation

List<SdlxFPoint> stackRectangle(SdlxFPoint p1, SdlxFPoint p2) {
  var stack = <SdlxFPoint>[];
  final double x1 = math.min(p1.x, p2.x);
  final double y1 = math.min(p1.y, p2.y);
  final double x2 = math.max(p1.x, p2.x);
  final double y2 = math.max(p1.y, p2.y);
  stack += stackLine(SdlxFPoint(x1, y1), SdlxFPoint(x2, y1));
  stack += stackLine(SdlxFPoint(x2, y1), SdlxFPoint(x2, y2));
  stack += stackLine(SdlxFPoint(x2, y2), SdlxFPoint(x1, y2));
  stack += stackLine(SdlxFPoint(x1, y2), SdlxFPoint(x1, y1));
  return stack.toList().toList();
}