You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Luc Maisonobe (JIRA)" <ji...@apache.org> on 2011/04/03 16:34:05 UTC

[jira] [Resolved] (MATH-554) Vector3D.crossProduct is sensitive to numerical cancellation

     [ https://issues.apache.org/jira/browse/MATH-554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luc Maisonobe resolved MATH-554.
--------------------------------

    Resolution: Fixed

fixed in subversion repository as of r1088316

> Vector3D.crossProduct is sensitive to numerical cancellation
> ------------------------------------------------------------
>
>                 Key: MATH-554
>                 URL: https://issues.apache.org/jira/browse/MATH-554
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 2.2
>         Environment: Linux, Sun JDK 1.5.0.22
>            Reporter: Luc Maisonobe
>            Assignee: Luc Maisonobe
>             Fix For: 3.0
>
>
> Cross product implementation uses the naive formulas (y1 z2 - y2 z1, ...). These formulas fail when vectors are almost colinear, like in the following example:
> {code}
> Vector3D v1 = new Vector3D(9070467121.0, 4535233560.0, 1);
> Vector3D v2 = new Vector3D(9070467123.0, 4535233561.0, 1);
> System.out.println(Vector3D.crossProduct(v1, v2));
> {code}
> The previous code displays { -1, 2, 0 } instead of the correct answer { -1, 2, 1 }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira