コード例 #1
0
 public Vector3 GetStart(float frame)
 {
     return(new Vector3(
                PosX.GetFrameValue(frame),
                PosY.GetFrameValue(frame),
                PosZ.GetFrameValue(frame)));
 }
コード例 #2
0
ファイル: AbsoluteControlForm.cs プロジェクト: radtek/HTLaser
        private void timer1_Tick(object sender, EventArgs e)
        {
            // ushort axis = GetAxis(); //轴号
            double dcurrent_speedX = 0, dcurrent_speedY = 0, dcurrent_speedZ = 0, dcurrent_speedW = 0; //速度值
            //  double dunitPosX, dunitPosY, dunitPosZ, dunitPosW; //脉冲当量转换后指令值
            int PosX, PosY, PosZ, PosW;                                                                //脉冲值

            LTDMC.dmc_read_current_speed_unit(_CardID, 0, ref dcurrent_speedX);                        // 读取轴当前速度
            LTDMC.dmc_read_current_speed_unit(_CardID, 1, ref dcurrent_speedY);
            LTDMC.dmc_read_current_speed_unit(_CardID, 2, ref dcurrent_speedZ);
            LTDMC.dmc_read_current_speed_unit(_CardID, 3, ref dcurrent_speedW);
            txtCurrentSpeedX.Text = dcurrent_speedX.ToString();
            txtCurrentSpeedY.Text = dcurrent_speedY.ToString();
            txtCurrentSpeedZ.Text = dcurrent_speedZ.ToString();
            txtCurrentSpeedW.Text = dcurrent_speedW.ToString();
            //LTDMC.dmc_get_position_unit(_CardID, 0, ref dunitPosX); //读取指定轴指令位置值
            //txtFinalPosY.Text = dunitPosX.ToString();
            PosX = LTDMC.dmc_get_position(_CardID, 0);//读取指定轴的脉冲值
            PosY = LTDMC.dmc_get_position(_CardID, 1);
            PosZ = LTDMC.dmc_get_position(_CardID, 2);
            PosW = LTDMC.dmc_get_position(_CardID, 3);
            txtCurrentPosX.Text = PosX.ToString();
            txtCurrentPosY.Text = PosY.ToString();
            txtCurrentPosZ.Text = PosZ.ToString();
            txtCurrentPosW.Text = PosW.ToString();
            if (LTDMC.dmc_check_done(_CardID, 0) == 0) // 读取指定轴运动状态
            {
                txtStateX.Text = "运行中";
            }
            else
            {
                txtStateX.Text = "停止中";
            }
            if (LTDMC.dmc_check_done(_CardID, 1) == 0) // 读取指定轴运动状态
            {
                txtStateY.Text = "运行中";
            }
            else
            {
                txtStateY.Text = "停止中";
            }
            if (LTDMC.dmc_check_done(_CardID, 2) == 0) // 读取指定轴运动状态
            {
                txtStateZ.Text = "运行中";
            }
            else
            {
                txtStateZ.Text = "停止中";
            }
            if (LTDMC.dmc_check_done(_CardID, 3) == 0) // 读取指定轴运动状态
            {
                txtStateW.Text = "运行中";
            }
            else
            {
                txtStateW.Text = "停止中";
            }
        }
コード例 #3
0
ファイル: Helm.cs プロジェクト: plasne/lost-in-space
    public void ReceiveTelemetry(TelemetryPayload payload)
    {
        // set position
        PosX.SetToNumber(Mathf.RoundToInt(payload.posx / 1000.0f));
        PosY.SetToNumber(Mathf.RoundToInt(payload.posy / 1000.0f));
        PosZ.SetToNumber(Mathf.RoundToInt(payload.posz / 1000.0f));

        // x is the y-dim and y is heading
        RotX.SetToNumber(Mathf.RoundToInt(payload.roty));
        var heading = (payload.rotx < 100) ? Mathf.CeilToInt(payload.rotx * -1) : Mathf.CeilToInt(360 - payload.rotx);

        RotY.SetToNumber(heading);
    }
コード例 #4
0
 public override string ToString()
 {
     return(String.Format("[{0}][{1}],[{2}],[{3}],[{4}],[{5}],[{6}],[{7}],[{8}],[{9}]", (Frame + 1).ToString().PadLeft(5),
                          PosX.ToString().ToFixedString(size, ' ').PadRight(padding),
                          PosY.ToString().ToFixedString(size, ' ').PadRight(padding),
                          PosZ.ToString().ToFixedString(size, ' ').PadRight(padding),
                          RotX.ToString().ToFixedString(size, ' ').PadRight(padding),
                          RotY.ToString().ToFixedString(size, ' ').PadRight(padding),
                          RotZ.ToString().ToFixedString(size, ' ').PadRight(padding),
                          RotW.ToString().ToFixedString(size, ' ').PadRight(padding),
                          ScaX.ToString().ToFixedString(size, ' ').PadRight(padding),
                          ScaY.ToString().ToFixedString(size, ' ').PadRight(padding),
                          ScaZ.ToString().ToFixedString(size, ' ').PadRight(padding)));
 }
コード例 #5
0
 public bool GetNextPosZ(BoardSpace target)
 {
     if (target == this)
     {
         return(true);
     }
     else if (!PosZ)
     {
         return(false);
     }
     else
     {
         return(PosZ.GetNextPosZ(target));
     }
 }
コード例 #6
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (Name.Length != 0)
        {
            hash ^= Name.GetHashCode();
        }
        if (PosX != 0F)
        {
            hash ^= PosX.GetHashCode();
        }
        if (PosY != 0F)
        {
            hash ^= PosY.GetHashCode();
        }
        if (PosZ != 0F)
        {
            hash ^= PosZ.GetHashCode();
        }
        if (RotX != 0F)
        {
            hash ^= RotX.GetHashCode();
        }
        if (RotY != 0F)
        {
            hash ^= RotY.GetHashCode();
        }
        if (RotZ != 0F)
        {
            hash ^= RotZ.GetHashCode();
        }
        if (Hp != 0)
        {
            hash ^= Hp.GetHashCode();
        }
        if (BossHp != 0)
        {
            hash ^= BossHp.GetHashCode();
        }
        if (Target != 0)
        {
            hash ^= Target.GetHashCode();
        }
        return(hash);
    }
コード例 #7
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (Name.Length != 0)
        {
            hash ^= Name.GetHashCode();
        }
        if (PosX != 0F)
        {
            hash ^= PosX.GetHashCode();
        }
        if (PosY != 0F)
        {
            hash ^= PosY.GetHashCode();
        }
        if (PosZ != 0F)
        {
            hash ^= PosZ.GetHashCode();
        }
        if (RotX != 0F)
        {
            hash ^= RotX.GetHashCode();
        }
        if (RotY != 0F)
        {
            hash ^= RotY.GetHashCode();
        }
        if (RotZ != 0F)
        {
            hash ^= RotZ.GetHashCode();
        }
        if (Hp != 0)
        {
            hash ^= Hp.GetHashCode();
        }
        if (IsHit != false)
        {
            hash ^= IsHit.GetHashCode();
        }
        return(hash);
    }
コード例 #8
0
    private void Update()
    {
        if (AnimationDir == 1)
        {
            T += Time.deltaTime * AnimationSpeed;
            if (T >= 1.0f)
            {
                T = 1.0f;
                if (ReverseOnFinish)
                {
                    AnimationDir = -1;
                }
                else
                {
                    AnimationDir = 0;
                }
            }
        }
        else if (AnimationDir == -1)
        {
            T -= Time.deltaTime * AnimationSpeed;
            if (T <= 0.0f)
            {
                T            = 0.0f;
                AnimationDir = 0;
            }
        }

        tr.localPosition = new Vector3(PosX.Evaluate(T), PosY.Evaluate(T), PosZ.Evaluate(T)) +
                           startPos;
        tr.localScale = new Vector3(startScale.x * ScaleX.Evaluate(T),
                                    startScale.y * ScaleY.Evaluate(T),
                                    startScale.z * ScaleZ.Evaluate(T));
        tr.localEulerAngles = new Vector3(tr.localEulerAngles.x, tr.localEulerAngles.y,
                                          startRot + Rot.Evaluate(T));
    }
コード例 #9
0
 internal unsafe Vector3 GetPosition(float index)
 {
     return(new Vector3(PosX.GetFrameValue(index), PosY.GetFrameValue(index), PosZ.GetFrameValue(index)));
 }