return z.times(p).times(m);
}
+ /** returns the constraint-conjunction "(forall v)Mv=v" */
+ public AffineConstraint getAffineConstraint(float epsilon) {
+ AffineConstraint c1 = getAffineConstraint(a-1, b, c, d , epsilon);
+ AffineConstraint c2 = getAffineConstraint(e, f-1, g, h , epsilon);
+ AffineConstraint c3 = getAffineConstraint(i, j, k-1, l , epsilon);
+ // FIXME: bottom row constraint?
+ return c1.intersect(c2.intersect(c3, epsilon), epsilon);
+ }
+
+ /** the AffineConstraint representing ax+by+cz+d=0 */
+ private static AffineConstraint getAffineConstraint(float a, float b, float c, float d, float epsilon) {
+ a = Math.abs(a) <= epsilon ? 0 : a;
+ b = Math.abs(b) <= epsilon ? 0 : b;
+ c = Math.abs(c) <= epsilon ? 0 : c;
+ d = Math.abs(d) <= epsilon ? 0 : d;
+ if (a!=0 || b!=0 || c!=0) return new Plane(a, b, c, d);
+ if (d==0) return AffineConstraint.ALL;
+ return AffineConstraint.NONE;
+ }
}