From 3adc453f534a555c8cf98a365c0d0d1d73bbf323 Mon Sep 17 00:00:00 2001 From: mtarini Date: Tue, 24 Jul 2012 01:48:21 +0000 Subject: [PATCH] Now zonohedra construction robust to basically *any* input, no matter how degenerate. --- vcg/complex/algorithms/create/zonohedron.h | 33 ++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/vcg/complex/algorithms/create/zonohedron.h b/vcg/complex/algorithms/create/zonohedron.h index 45c4c5df..8a686e19 100644 --- a/vcg/complex/algorithms/create/zonohedron.h +++ b/vcg/complex/algorithms/create/zonohedron.h @@ -132,8 +132,17 @@ private: return -v; } + static Vec3 altVec(int i) { + return Vec3(1, i, i*i); + } + + static Scalar tripleProduct( const Vec3 &a, const Vec3 &b, const Vec3 & c){ + return ( a ^ b ) * c; + } + // returns signof: (i x j) * k bool signOf_IxJoK(VecIndex i, VecIndex j, VecIndex k){ + const float EPSILON_SQUARED = 1e-12; bool invert = false; // sort i,j,k if (i=0) != invert ); // XOR