Oriented planes are the reason GTSAM switched from optimizing over groups to optimizing over manifolds. OrientedPlane3 represents a plane by a unit normal and signed distance from the origin; reversing all four coefficients represents the opposite oriented plane.
import gtsam
import numpy as npInitialization¶
Construct from a Unit3 normal and distance, a four-vector, or four scalar coefficients. Non-unit coefficient vectors are normalized internally.
plane = gtsam.OrientedPlane3(gtsam.Unit3(0.0, 0.0, 1.0), -2.0)
same_plane = gtsam.OrientedPlane3(0.0, 0.0, 1.0, -2.0)
print("coefficients:", plane.planeCoefficients())
print("same plane:", plane.equals(same_plane, 1e-12))Normal, distance, and error¶
normal() and distance() expose the minimal representation. errorVector(other) returns a three-dimensional manifold discrepancy: two coordinates for normal direction and one for distance.
tilted = gtsam.OrientedPlane3(gtsam.Unit3(0.1, 0.0, 1.0), -2.1)
print("normal:", plane.normal().unitVector())
print("distance:", plane.distance())
print("error to tilted plane:", plane.errorVector(tilted))Transforming a plane¶
transform(pose) expresses the plane after applying a Pose3. This is the dual operation to transforming points; both the normal and signed distance can change.
pose = gtsam.Pose3(gtsam.Rot3.Rx(0.2), np.array([0.0, 0.0, 1.0]))
transformed = plane.transform(pose)
print("transformed coefficients:", transformed.planeCoefficients())