/// <summary> /// rotates to right. /// </summary> /// <param name="Angle">angle.</param> /// <param name="Duration">duration in millisecond.</param> /// <param name="KeepCenter">if is true, the <see cref="Camera.Anchor"/> is fix.</param> /// <returns>OglAnimator</returns> public OglAnimator LookRight(float Angle, long Duration, bool KeepCenter) { if (Duration < 1) { LineType L = new LineType(); if (KeepCenter) { L = new LineType(Center, Base.BaseY); } else { L = new LineType(Position, Base.BaseY); } Device.ProjectionMatrix = Device.ProjectionMatrix * Matrix.Rotation(L, Angle); Device.Refresh(); } else { SetAnimator(LeftRight, 0, Angle, Duration, KeepCenter); } return(LeftRight); }
/// <summary> /// This method calculates the distance to an other line only if the distance is /// smaller than MaxDist, otherwise Utils.big will be returned. /// Imagine a cylinder with radius MaxDist around the line. If now a line passes the /// cylinder, a reasonable result for the lenght of the distance will be returned. /// If CheckP is true, additional to the Cylinder a halfsphere with center P and radius Maxdist is /// considered and analogusly for CheckQ. /// </summary> /// <param name="L">The other line which will be tested</param> /// <param name="MaxDist">The maximal distance at which a reasonable result is returned.</param> /// <param name="CheckP">If CheckP is true: a line, which has to point P a distance less than Maxdist, a result will be returned. </param> /// <param name="CheckQ">If CheckQ is true: a line, which has to point Q a distance less than Maxdist, a result will be returned. </param> /// <param name="Lam">The param Lam can be taken to calculate the nearest point on the line by Value(Lam)</param> /// <returns>In case the distance of the line is smaller than Maxdist, the distance is returned otherwise. <see cref="Utils.big"/> /// </returns> public double __Distance(LineType L, double MaxDist, bool CheckP, bool CheckQ, out double Lam) { double DummyLam = -1; return(Distance(L, MaxDist, out DummyLam, out Lam)); }
/// <summary> /// makes a rotation of the scene. /// </summary> /// <param name="L">the rotation axis. See also <see cref="LineType"/></param> /// <param name="Angle">the rotation angle.</param> public void Rotate(LineType L, double Angle) { MulMatrix(Matrix.Rotation(L, Angle)); }
/// <summary> /// This method calculates the distance to an other line only if the distance is /// smaller than MaxDist, otherwise Utils.big will be returned. /// Imagine a cylinder with radius MaxDist around the line. If now a line passes the /// cylinder, a reasonable result for the lenght of the distance will be returned. /// If CheckP is true, additional to the Cylinder a halfsphere with center P and radius Maxdist is /// considered and analogusly for CheckQ. /// </summary> /// <param name="L">The other line which will be tested</param> /// <param name="MaxDist">The maximal distance at which a reasonable result is returned.</param> /// <param name="CheckP">If CheckP is true: a line, which has to point P a distance less than Maxdist, a result will be returned. </param> /// <param name="CheckQ">If CheckQ is true: a line, which has to point Q a distance less than Maxdist, a result will be returned. </param> /// <param name="Lam">The param Lam can be taken to calculate the nearest point on the line by Value(Lam)</param> /// <param name="LineLam">The param relative to the other Line. The nearest point on the line by L.Value(LineLam)</param> /// <returns>In case the distance of the line is smaller than Maxdist, the distance is returned otherwise. <see cref="Utils.big"/> /// </returns> public double __Distance(LineType L, double MaxDist, bool CheckP, bool CheckQ, out double Lam, out double LineLam) { double dil = Utils.big; double dia = Utils.big; double dib = Utils.big, Lam1, Lam2; double result = Utils.big; xyz dummy, xyz2; //CheckP = false; //CheckQ = false; Lam = -1; LineLam = -1; double di = Distance(L, out Lam1, out Lam2, out dummy, out xyz2); xyz NN = Value(Lam1); if (Utils.Equals(di, Utils.big)) { return(di); } if (!Utils.Less(MaxDist, di) && !Utils.Less(Lam2, 0) && !Utils.Less(1, Lam2)) { dil = di; } if ((!CheckP) && (!CheckQ)) { if (di < MaxDist) { Lam = Lam2; LineLam = Lam1; return(di); } } double LL = -1; if (CheckP) { dia = Distance(L.P, out LL, out dummy); } if (CheckQ) { dib = Distance(L.Q, out LL, out dummy); } if (!Utils.Less(MaxDist, dia) && !Utils.Less(dil, dia) && !Utils.Less(dib, dia)) { Lam = 0; LineLam = Lam1; result = dia; } else if (!Utils.Less(MaxDist, dib) && !Utils.Less(dil, dib) && !Utils.Less(dia, dib)) { Lam = 1; LineLam = Lam1; result = dib; } else if (!Utils.Less(MaxDist, dil) && Utils.Less(dil, dia) && Utils.Less(dil, dib)) { Lam = Lam2; LineLam = Lam1; result = dil; } return(result); }
/// <summary> /// Returns a rotationmatrix with the linetype L and the rotationangle Angle /// Of course L doesn`t have to contain the origin /// </summary> /// <param name="L">Rotationaxis</param> /// <param name="Angle">Rotationangle rad</param> /// <returns>Rotationmatrix</returns> static public Matrix Rotation(LineType L, double Angle) { return(Matrix.Rotation(L.P, L.Direction, Angle)); }