示例#1
0
        private void Dotrace()
        {
            lock (trace)
            {
                try
                {
                    PPoint newPoint = new PPoint(0, 0, 0, 2000f);

                    if (trace.Count > 0)
                    {
                        newPoint.assign((Point3)Position - (Point3)trace.Last <PPoint>());

                        while (trace[0].Alpha == 0)
                        {
                            trace.RemoveAt(0);
                        }
                    }
                    else
                    {
                        newPoint.assign(Position);
                    }

                    float n = (float)Math.Sqrt(Math.Pow(newPoint.x, 2) + Math.Pow(newPoint.y, 2) + Math.Pow(newPoint.z, 2));

                    if (n > 0.1)
                    {
                        trace.Add(new PPoint(Position.x, Position.y, Position.z, 2000f));
                    }
                }
                catch (Exception)
                {
                }
            }
        }
示例#2
0
        /// <summary>
        /// ein Tick im Thread
        /// </summary>
        private void ThreadTick()
        {
            // Bewegung
            _Pos.x += _Dir.x * _Speed;
            _Pos.y += _Dir.y * _Speed;
            _Pos.z += _Dir.z * _Speed;

            // Drehung um  _dAngle Grad um Z Axe.
            Point3 ZAxis = new Point3(0, 0, 1);
            Matrix rot   = new Matrix();

            rot.RotMatrix(_dAngle, ZAxis);
            _Dir.assign(MM.MatDotPoint(rot, (Point3)_Dir));

            // Rotation
            _AngleZ    = (_AngleZ - 1f) % 360;
            _SunAngleZ = (_SunAngleZ + 0.01f) % 360;


            // Trace
            if (showTrace)
            {
                lock (trace)
                {
                    PPoint newPoint = new PPoint(0, 0, 0, 2000f);

                    if (trace.Count > 0)
                    {
                        newPoint.assign((Point3)_Pos - (Point3)trace.Last <PPoint>());

                        while (trace[0].Alpha == 0)
                        {
                            trace.RemoveAt(0);
                        }
                    }
                    else
                    {
                        newPoint.assign(_Pos);
                    }

                    float n = (float)Math.Sqrt(Math.Pow(newPoint.x, 2) + Math.Pow(newPoint.y, 2) + Math.Pow(newPoint.z, 2));

                    if (n > 0.1)
                    {
                        trace.Add(new PPoint(_Pos.x, _Pos.y, _Pos.z, 2000f));
                    }
                }
            }
            else
            {
                trace.Clear();
            }
        }
示例#3
0
        /// <summary>
        /// Berechnung der Leuchspur
        /// </summary>
        public void Trace()
        {
            // Der TraceCnt verzögert die Erstellung von Tracepunkten und erhöht somit die Leistung
            if (TraceCnt == 3)
            {
                TraceCnt = 0;
                try
                {
                    lock (trace)
                    {
                        PPoint newPoint = new PPoint(0, 0, 0, 2000f);

                        if (trace.Count > 0)
                        {
                            newPoint.assign((Point3)Position - (Point3)trace.Last <PPoint>());
                        }
                        else
                        {
                            newPoint.assign(Position);
                        }

                        float n = (float)Math.Sqrt(Math.Pow(newPoint.x, 2) + Math.Pow(newPoint.y, 2) + Math.Pow(newPoint.z, 2));

                        if (n > 0.1)
                        {
                            trace.Add(new PPoint(Position.x, Position.y, Position.z, 2000f));
                        }

                        while (trace[0].Alpha == 0)
                        {
                            trace.RemoveAt(0);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
            TraceCnt++;
        }
示例#4
0
文件: Discobobb.cs 项目: 4nu81/3dlab
        private void Dotrace()
        {
            lock (trace)
            {
                try
                {
                    PPoint newPoint = new PPoint(0, 0, 0, TraceTime);

                    if (trace.Count > 0)
                    {
                        newPoint.assign((Point3)Position - (Point3)trace.Last<PPoint>());

                        while (trace[0].Alpha == 0)
                        {
                            trace.RemoveAt(0);
                        }
                    }
                    else
                    {
                        newPoint.assign(Position);
                    }

                    float n = (float)Math.Sqrt(Math.Pow(newPoint.x, 2) + Math.Pow(newPoint.y, 2) + Math.Pow(newPoint.z, 2));

                    if (n > 0.1)
                    {
                        trace.Add(new PPoint(Position.x, Position.y, Position.z, TraceTime));
                    }
                }
                catch (Exception)
                {
                }
            }
        }
示例#5
0
        /// <summary>
        /// Berechnung der Leuchspur
        /// </summary>
        public void Trace()
        {
            // Der TraceCnt verzögert die Erstellung von Tracepunkten und erhöht somit die Leistung
            if (TraceCnt == 3)
            {
                TraceCnt = 0;
                try
                {
                    lock (trace)
                    {
                        PPoint newPoint = new PPoint(0, 0, 0,2000f);

                        if (trace.Count > 0)
                        {
                            newPoint.assign((Point3)Position - (Point3)trace.Last<PPoint>());
                        }
                        else
                        {
                            newPoint.assign(Position);
                        }

                        float n = (float)Math.Sqrt(Math.Pow(newPoint.x, 2) + Math.Pow(newPoint.y, 2) + Math.Pow(newPoint.z, 2));

                        if (n > 0.1)
                        {
                            trace.Add(new PPoint(Position.x, Position.y, Position.z,2000f));
                        }

                        while (trace[0].Alpha == 0)
                        {
                            trace.RemoveAt(0);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
            TraceCnt++;
        }
示例#6
0
文件: Planet.cs 项目: 4nu81/3dlab
        /// <summary>
        /// ein Tick im Thread
        /// </summary>
        private void ThreadTick()
        {
            // Bewegung
            _Pos.x += _Dir.x * _Speed;
            _Pos.y += _Dir.y * _Speed;
            _Pos.z += _Dir.z * _Speed;

            // Drehung um  _dAngle Grad um Z Axe.
            Point3 ZAxis = new Point3(0, 0, 1);
            Matrix rot = new Matrix();
            rot.RotMatrix(_dAngle, ZAxis);
            _Dir.assign(MM.MatDotPoint(rot, (Point3)_Dir));

            // Rotation
            _AngleZ = (_AngleZ - 1f) % 360;
            _SunAngleZ = (_SunAngleZ + 0.01f) % 360;

            // Trace
            if (showTrace)
            {
                lock (trace)
                {
                    PPoint newPoint = new PPoint(0, 0, 0,2000f);

                    if (trace.Count > 0)
                    {
                        newPoint.assign((Point3)_Pos - (Point3)trace.Last<PPoint>());

                        while (trace[0].Alpha == 0)
                        {
                            trace.RemoveAt(0);
                        }
                    }
                    else
                    {
                        newPoint.assign(_Pos);
                    }

                    float n = (float)Math.Sqrt(Math.Pow(newPoint.x, 2) + Math.Pow(newPoint.y, 2) + Math.Pow(newPoint.z, 2));

                    if (n > 0.1)
                    {
                        trace.Add(new PPoint(_Pos.x, _Pos.y, _Pos.z,2000f));
                    }
                }
            }
            else
            {
                trace.Clear();
            }
        }