~ubuntu-branches/ubuntu/wily/oolite/wily-proposed

« back to all changes in this revision

Viewing changes to src/Core/Scripting/OOJSVector.m

  • Committer: Package Import Robot
  • Author(s): Nicolas Boulenguez
  • Date: 2011-12-22 00:22:39 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20111222002239-pr3upeupp4jw1psp
Tags: 1.76-1
* New upstream.
* watch: scan upstream stable releases instead of dev snapshots.
* control: use default gobjc instead of explicit 4.6.
* rules: use dpkg-dev build flags.

Show diffs side-by-side

added added

removed removed

Lines of Context:
744
744
        if (EXPECT_NOT(!GetThisVector(context, OOJS_THIS, &thisv, @"angleTo"))) return NO;
745
745
        if (EXPECT_NOT(!VectorFromArgumentList(context, @"Vector3D", @"angleTo", argc, OOJS_ARGV, &thatv, NULL)))  return NO;
746
746
        
747
 
        result = acosf(dot_product(vector_normal(thisv), vector_normal(thatv)));
 
747
        result = dot_product(vector_normal(thisv), vector_normal(thatv));
 
748
        if (result > 1.0f) result = 1.0f;
 
749
        if (result < -1.0f) result = -1.0f;
 
750
        // for identical vectors the dot_product sometimes returnes a value > 1.0 because of rounding errors, resulting
 
751
        // in an undefined result for the acosf.
 
752
        result = acosf(result);
748
753
        
749
754
        OOJS_RETURN_DOUBLE(result);
750
755