28 lines
		
	
	
		
			816 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			816 B
		
	
	
	
		
			C#
		
	
	
	
	
	
using NUnit.Framework;
 | 
						|
 | 
						|
namespace LinearAlgebra.Test {
 | 
						|
    public class SphericalTest {
 | 
						|
        [SetUp]
 | 
						|
        public void Setup() {
 | 
						|
        }
 | 
						|
 | 
						|
        [Test]
 | 
						|
        public void FromVector3() {
 | 
						|
            Vector3 v = new(0, 0, 1);
 | 
						|
            Spherical s = Spherical.FromVector3(v);
 | 
						|
            Assert.AreEqual(1.0f, s.distance, "s.distance 0 0 1");
 | 
						|
            Assert.AreEqual(0.0f, s.direction.horizontal, "s.hor 0 0 1");
 | 
						|
            Assert.AreEqual(0.0f, s.direction.vertical, "s.vert 0 0 1");
 | 
						|
        }
 | 
						|
 | 
						|
        [Test]
 | 
						|
        public void Addition() {
 | 
						|
            Spherical v1 = Spherical.Degrees(1, 45, 0);
 | 
						|
            Spherical v2 = Spherical.zero;
 | 
						|
            Spherical r = Spherical.zero;
 | 
						|
 | 
						|
            r = v1 + v2;
 | 
						|
            Assert.AreEqual(v1.distance, r.distance, "Addition(0,0,0)");
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |