Exemple #1
0
        public void ConstructorParameterless()
        {
            FloatAxial floatAxial = new FloatAxial();

            Assert.That( floatAxial.q, Is.EqualTo( 0f ) );
            Assert.That( floatAxial.r, Is.EqualTo( 0f ) );
        }
Exemple #2
0
        public void ConstructorQR()
        {
            FloatAxial floatAxial = new FloatAxial( 1f, 2f );

            Assert.That( floatAxial.q, Is.EqualTo( 1f ) );
            Assert.That( floatAxial.r, Is.EqualTo( 2f ) );
        }
Exemple #3
0
        public void ToFloatCubic()
        {
            FloatCubic floatCubic = new FloatAxial( 1f, 2f ).ToFloatCubic();

            Assert.That( floatCubic.x, Is.InRange<float>(  1f - EPSILON,  1f + EPSILON ) );
            Assert.That( floatCubic.y, Is.InRange<float>( -3f - EPSILON, -3f + EPSILON ) );
            Assert.That( floatCubic.z, Is.InRange<float>(  2f - EPSILON,  2f + EPSILON ) );
        }
Exemple #4
0
        public void ConstructorAxial()
        {
            AxialHexCoord axial = new AxialHexCoord( 1, 2 );
            FloatAxial floatAxial = new FloatAxial( axial );

            Assert.That( floatAxial.q, Is.InRange<float>( 1f - EPSILON, 1f + EPSILON ) );
            Assert.That( floatAxial.r, Is.InRange<float>( 2f - EPSILON, 2f + EPSILON ) );
        }
Exemple #5
0
        public void Round()
        {
            FloatCubic floatCubic = new FloatAxial( 1.2f, 2.2f ).ToFloatCubic();
            CubicHexCoord rounded = floatCubic.Round();
            AxialHexCoord axial = rounded.ToAxial();

            Assert.That( axial.q, Is.EqualTo( 1 ) );
            Assert.That( axial.r, Is.EqualTo( 2 ) );
        }