|Re: [eigen] Rotations and unit vectors|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Rotations and unit vectors
- From: Dick Lyon <dicklyon@xxxxxxxxxx>
- Date: Tue, 7 May 2013 09:45:34 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=yeqgU6IPhXWgvm/UBp9uJoXBXy7CNcXSJv6amYW8C2M=; b=FC/K7Sqw9W+3ukxloICx8B4wqpgim1kpsW8p+xidkmEbWfNfj8O0Gv8SFtSGxHyq8n VTkpg1HaXHSTK2Gy/PiCfcXpMxSg0YVz2zbA9U/gr3yj/Uvx4P4YFrz6PUCsZmqxvbLI V8Gdo4oX76V/HhUHYxCmbWSzq6gCjn3xz9CufFQkZwr9MW5Afz0WCPQHetIIRWYw/gCI OzAnXdXmFOsI/Blr9lqqMPe7CiyCaCJjbsv2nhbB0P7z4Py7DxTeoEW8NYP3MCK8OWIM jbhd9tw39z6PY7IfbzQP/jxtRlnRLrz/aIJKFksuEzngZ+LFadY+pVHBaKZe5QOn2TQO z1vw==
How about this: compute the norm of the unit vector, and compare it to 1. If it's not very close, don't fail out, but normalize the vector.
Or wrap existing functions with new versions that check and correct norms of unit vectors, so the programmer can use one or the other; or have a mode flag that controls whether to normalize; you could even have a mode to fail out, but people who want a strong check.
Maybe a CHECK_UNIT_VECTOR_NORM(vec, tolerance) that would compile to nothing, or to an assert, or to a re-normalization, depending on mode.