discontinuedPackage jet_cad_floor_plan has been discontinued and replaced by jet_cad_2d_plan.

intersect function

Vector2? intersect(
  1. Vector2 p,
  2. Vector2 a,
  3. Vector2 q,
  4. Vector2 b,
)

The intersection of p + u·a and q + v·b, or null when the directions are parallel within wallJoin.angular.

Implementation

Vector2? intersect(Vector2 p, Vector2 a, Vector2 q, Vector2 b) {
  final cross = a.x * b.y - a.y * b.x;
  if (cross.abs() <= wallJoin.angular) return null;
  final w = q - p;
  final u = (w.x * b.y - w.y * b.x) / cross;
  return p + a * u;
}