Example #1
0
        public static Vector3 UnpackRotation(Byte3 rot)
        {
            var pitch = Remap(rot.X, 0, 255, 0, 360);
            var yaw   = Remap(rot.Y, 0, 255, 0, 360);
            var roll  = Remap(rot.Z, 0, 255, 0, 360);

            return(new Vector3(pitch, yaw, roll));
        }
Example #2
0
 public AMask(Byte1 byte1 = Byte1.None, Byte2 byte2 = Byte2.None, Byte3 byte3 = Byte3.None,
              Byte4 byte4 = Byte4.None)
 {
     Mask = (AMaskValues)(((int)byte1 << 8 * 3) |
                          ((int)byte2 << 8 * 2) |
                          ((int)byte3 << 8 * 1) |
                          ((int)byte4));
 }
Example #3
0
    public void Byte3_Nullable_Write_DefaultShouldBeWritten(byte defaultValueX, byte defaultValueY, byte defaultValueZ)
    {
        var defaultValue = new Byte3(defaultValueX, defaultValueY, defaultValueZ);

        GeneralTest_Write_Nullable_DefaultShouldBeWritten(
            (rw, value, defaultValue) => rw.Byte3(ref value, defaultValue),
            r => r.ReadByte3(), defaultValue);
    }
Example #4
0
 public FMask(Byte1 byte1 = Byte1.None, Byte2 byte2 = Byte2.None, Byte3 byte3 = Byte3.None,
              Byte4 byte4 = Byte4.None, Byte5 byte5 = Byte5.None)
 {
     Mask = (FMaskValues)(((long)byte1 << 8 * 4) |
                          ((long)byte2 << 8 * 3) |
                          ((long)byte3 << 8 * 2) |
                          ((long)byte4 << 8) |
                          ((long)byte5));
 }
Example #5
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = Byte1.GetHashCode();
         hashCode = (hashCode * 397) ^ Byte2.GetHashCode();
         hashCode = (hashCode * 397) ^ Byte3.GetHashCode();
         hashCode = (hashCode * 397) ^ Byte4.GetHashCode();
         return(hashCode);
     }
 }
Example #6
0
    public void Byte3_Write_Ref_ShouldBeEqual(byte valueX, byte valueY, byte valueZ)
    {
        var value = new Byte3(valueX, valueY, valueZ);

        GeneralTest_Write_Ref_ShouldBeEqual((rw, value) =>
        {
            rw.Byte3(ref value);
            return(value);
        },
                                            value);
    }
Example #7
0
    public void Byte3_Nullable_Read_Ref_ShouldEqualExampleValue(byte exampleValueX, byte exampleValueY, byte exampleValueZ)
    {
        var exampleValue = new Byte3(exampleValueX, exampleValueY, exampleValueZ);

        GeneralTest_Read_Ref_ShouldEqualExampleValue <Byte3?>((rw, value) =>
        {
            rw.Byte3(ref value);
            return(value);
        },
                                                              w => w.Write(exampleValue), exampleValue);
    }
Example #8
0
 public AMask(Byte1 byte1 = Byte1.None, Byte2 byte2 = Byte2.None, Byte3 byte3 = Byte3.None,
              Byte4 byte4 = Byte4.None, Byte5 byte5 = Byte5.None, Byte6 byte6 = Byte6.None,
              Byte7 byte7 = Byte7.None)
 {
     Mask = (AMaskValues)
            ((ulong)byte1 << 8 * 6 |
             (ulong)byte2 << 8 * 5 |
             (ulong)byte3 << 8 * 4 |
             (ulong)byte4 << 8 * 3 |
             (ulong)byte5 << 8 * 2 |
             (ulong)byte6 << 8 * 1 |
             (ulong)byte7 << 8 * 0);
 }
Example #9
0
        void CalculateVerticies(int id)
        {
            // convert id into coordinates
            int3 vecId = verticesExpanded.IdToCoord(id);

            Byte3 vert = new Byte3(0, 0, 0);

            // for each coordinate calculate 3 potential vertices
            vert.x = VertexFromDirection(new int3(1, 0, 0), vecId);
            vert.y = VertexFromDirection(new int3(0, 1, 0), vecId);
            vert.z = VertexFromDirection(new int3(0, 0, 1), vecId);

            verticesExpanded[id] = vert;
        }
Example #10
0
 public override string ToString()
 {
     return(CenterX.ToString() + ", " + CenterY.ToString() + ", " + SizeX.ToString() + ", " + SizeY.ToString() + ", " +
            NodeIndex.ToString() + ", " + NodeCount.ToString() + ", " + Short7.ToString() + ", " + Short8.ToString() + ", " +
            FloatUtil.ToString(Float1) + ", " + Byte1.ToString() + ", " + Byte2.ToString() + ", " + Byte3.ToString() + ", " + Byte4.ToString());
 }
Example #11
0
 /// <exception cref="IOException">An I/O error occurs.</exception>
 /// <exception cref="ObjectDisposedException">The stream is closed.</exception>
 public void Write(Byte3 value)
 {
     Write(value.X);
     Write(value.Y);
     Write(value.Z);
 }
Example #12
0
 /// <summary>
 /// 转为T28181云台控制命令
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(Byte1.ToString("X2") + Byte2.ToString("X2") + Byte3.ToString("X2") + Byte4.ToString("X2") +
            Byte5.ToString("X2") + Byte6.ToString("X2") + Byte7.ToString("X2") + Byte8.ToString("X2"));
 }
Example #13
0
			public AMask(Byte1 byte1 = Byte1.None, Byte2 byte2 = Byte2.None, Byte3 byte3 = Byte3.None,
			             Byte4 byte4 = Byte4.None, Byte5 byte5 = Byte5.None, Byte6 byte6 = Byte6.None,
			             Byte7 byte7 = Byte7.None)
			{
				Mask = (AMaskValues)
				       ((ulong)byte1 << 8 * 6 |
				        (ulong)byte2 << 8 * 5 |
				        (ulong)byte3 << 8 * 4 |
				        (ulong)byte4 << 8 * 3 |
				        (ulong)byte5 << 8 * 2 |
				        (ulong)byte6 << 8 * 1 |
				        (ulong)byte7 << 8 * 0);
			}