With C # 6.0, you can shorten math links by adding a declaration using static :
using static System.Math;
This allows you to use static members of type Math without specifying a type name:
public void Foo() { var bar = Sin(8); }
It’s not possible to do this “globally,” since it’s currently not possible at all to use global usage of an ad.
For those who do not use C # 6
but will this not reduce performance (due to the overhead of function calls)?
I would not worry about that. First write your code to read. We can write a method in several ways. First, just add a space:
return new Vector3( Math.Sin(az) * Math.Cos(el), Math.Cos(az) * Math.Cos(el), Math.Sin(el) );
You can also put this in a helper method.
jcolebrand answer is also nice to do this, but you need to add using m = System.Math; everywhere.
vcsjones
source share