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) { } } }
/// <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(); } }
/// <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++; }
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) { } } }
/// <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++; }
/// <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(); } }