Package com.flarerobotics.lib.region
Class Surface3d
java.lang.Object
com.flarerobotics.lib.region.Surface3d
Represents a finite quadrilateral surface in 3D defined by four corner points.
-
Constructor Summary
ConstructorsConstructorDescriptionSurface3d
(edu.wpi.first.math.geometry.Translation3d p1, edu.wpi.first.math.geometry.Translation3d p2, edu.wpi.first.math.geometry.Translation3d p3, edu.wpi.first.math.geometry.Translation3d p4) Constructs a new Surface3d. -
Method Summary
Modifier and TypeMethodDescriptionboolean
isColliding
(edu.wpi.first.math.geometry.Pose3d testPose) Tests if a single pose lies within the finite quad surface (including edges).boolean
isColliding
(edu.wpi.first.math.geometry.Pose3d lastPose, edu.wpi.first.math.geometry.Pose3d currentPose) Tests if the linear motion from lastPose to currentPose intersects the finite quad.
-
Constructor Details
-
Surface3d
public Surface3d(edu.wpi.first.math.geometry.Translation3d p1, edu.wpi.first.math.geometry.Translation3d p2, edu.wpi.first.math.geometry.Translation3d p3, edu.wpi.first.math.geometry.Translation3d p4) Constructs a new Surface3d.Validates that the first three points are non-collinear and that the fourth point is coplanar. The provided points must be in order.
- Parameters:
p1
- The first corner.p2
- The second corner.p3
- The third corner.p4
- The fourth corner.- Throws:
IllegalArgumentException
- If points are invalid or non-coplanar
-
-
Method Details
-
isColliding
public boolean isColliding(edu.wpi.first.math.geometry.Pose3d testPose) Tests if a single pose lies within the finite quad surface (including edges).- Parameters:
testPose
- The pose to test.- Returns:
- true if the point is on the plane.
-
isColliding
public boolean isColliding(edu.wpi.first.math.geometry.Pose3d lastPose, edu.wpi.first.math.geometry.Pose3d currentPose) Tests if the linear motion from lastPose to currentPose intersects the finite quad.- Parameters:
lastPose
- The starting pose.currentPose
- The ending pose.- Returns:
- true if the segment crosses or touches the quad.
-