Author Topic: MathD does not exist  (Read 3029 times)

Ninja

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 21
    • View Profile
MathD does not exist
« on: October 29, 2017, 06:04:14 PM »
Ever since the commit on September 25th, I have gotten the error 'The name `MathD' does not exist in the current context' for the new Vector2D / 3D files.

What is MathD and how do I get it?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: MathD does not exist
« Reply #1 on: November 06, 2017, 07:47:52 AM »
My bad, it's a file from Sightseer. Basically a copy of Mathf, but with double precision.

You can resolve it by replacing MathD with adding a Clamp function:
  1.                 static public double Angle (Vector3D from, Vector3D to)
  2.                 {
  3.                         return Math.Acos(Clamp(Dot(from.normalized, to.normalized), -1d, 1d)) * 57.29578d;
  4.                 }
  5.  
  6.                 static double Clamp (double value, double min, double max)
  7.                 {
  8.                         if (value < min) value = min;
  9.                         else if (value > max) value = max;
  10.                         return value;
  11.                 }
The other MathD usage can be replaced with Math.

Ninja

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 21
    • View Profile
Re: MathD does not exist
« Reply #2 on: November 06, 2017, 02:55:18 PM »
Ah I see, thanks for the help!