|Re: [eigen] Rotations and unit vectors|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: [eigen] Rotations and unit vectors
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Tue, 7 May 2013 10:47:03 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=k9h6NEJPoksi+vBbFHotZ32l0rf5XW7H3A/HATOCMWA=; b=u61UYW2yqaBZ1BhyKffA5M55CHDSuR+VHHFvSXW8Q36+deYO+0jsyNz05JcPUvoA0I M+DBz36mYHiP3UCKZnVsmdDG1jGTy/59/f7gvQKBQNtHh2PQ2aPac3ljByr96Zrncnti +TTupa1FTSxWhQVVP+m4lH468u/tvPNzD89W7op5lnklJ6Awde8NYRXXsoZbKhJowV2g RmgiRoL/r7H/XTQtYc8VjPVPbc/GiIkoNmznBCuYoelIcWuYImRi4/M9/1xBrGZb6sce H79gGmt1t3hzPrCRoOQSfQKlIWbDWQa4ZCWWSJqX2hU2+cr+X9Rl+Z901aY9VylrBX9D tdbA==
I agree with Hauke that this deserves checking, and it should probably be checked by default in debug builds, otherwise people will just not think of enabling the right preprocessor switch.
But it's probably never OK to assert on anything that can depend on floating point values: that gives too finicky crashes (it doesn't help much that it's only #ifndef NDEBUG).
What you could in debug builds, is mimic the behavior of floating point numbers in 'bad' cases: you could simply return a rotation filled with NaN coefficients (based on a check you only perform in debug builds).
You would still have to use a quite large tolerance to avoid this kicking in when it's not wanted... do we still have the 'dummy' precision values? That would be a decent choice.
NaN helps debugging in 2 ways:
- it's particularly obvious that something went wrong;
- you can turn on FP signals, so you could catch the first such error in your debugger.