/// <summary> /// Computes the slope difference between two tracks. /// </summary> /// <param name="u">slope of the upstream segment.</param> /// <param name="d">slope of the downstream segment.</param> /// <param name="uz">upstream Z.</param> /// <param name="dz">uownstream Z.</param> /// <returns></returns> protected SySal.BasicTypes.Vector2 SlopeDiff(SySal.BasicTypes.Vector u, SySal.BasicTypes.Vector d, double uz, double dz) { SySal.BasicTypes.Vector2 r = new Vector2(); double leadplates = Math.Round((dz - uz) / 1300.0); if (leadplates < 1.0) { r.X = r.Y = -1.0; } else { leadplates = 1.0 / Math.Sqrt(leadplates); d.X -= u.X; d.Y -= u.Y; double n = u.X * u.X + u.Y * u.Y; if (n <= 0.0) { n = 1.0; u.X = 1.0; u.Y = 0.0; } else { n = 1.0 / Math.Sqrt(n); u.X *= n; u.Y *= n; } r.X = Math.Abs(d.X * u.X + d.Y * u.Y) * leadplates; r.Y = Math.Abs(d.X * u.Y - d.Y * u.X) * leadplates; } return(r); }
public bool Filter(SySal.TotalScan.Track t) { if (t.Length < 3) { return(false); } double dz = t.Upstream_Z - m_MainVertexPos.Z; if (Math.Round(dz / 1300.0) < -3.0 || Math.Round(dz / 1300.0) > 4.0) { return(false); } double ipcut = 800.0; SySal.Tracking.MIPEmulsionTrackInfo[] segs = ((SySal.TotalScan.Flexi.Track)t).BaseTracks; if (segs.Length < 2) { return(false); } SySal.BasicTypes.Vector p = t[t.Length - 1].Info.Intercept; SySal.BasicTypes.Vector s = segs[segs.Length - 1].Slope; s.Z = 1.0 / Math.Sqrt(s.X * s.X + s.Y * s.Y + 1.0); s.X *= s.Z; s.Y *= s.Z; p.X -= m_MainVertexPos.X; p.Y -= m_MainVertexPos.Y; p.Z -= m_MainVertexPos.Z; double dx = p.Y * s.Z - p.Z * s.Y; double dy = p.Z * s.X - p.X * s.Z; dz = p.X * s.Y - p.Y * s.X; return(dx * dx + dy * dy + dz * dz <= ipcut * ipcut); }
/// <summary> /// Deforms a vector using the linear deformation. /// </summary> /// <param name="inV">the input vector.</param> /// <returns>the transformed vector.</returns> public SySal.BasicTypes.Vector Deform(SySal.BasicTypes.Vector inV) { SySal.BasicTypes.Vector v = new SySal.BasicTypes.Vector(); v.X = MXX * inV.X + MXY * inV.Y; v.Y = MYX * inV.X + MYY * inV.Y; v.Z = inV.Z; return(v); }
/// <summary> /// Transforms a point according to the affine transformation. /// </summary> /// <param name="inV">the input 3D point.</param> /// <returns>the transformed point.</returns> public SySal.BasicTypes.Vector Transform(SySal.BasicTypes.Vector inV) { SySal.BasicTypes.Vector v = new SySal.BasicTypes.Vector(); v.X = MXX * (inV.X - RX) + MXY * (inV.Y - RY) + TX + RX; v.Y = MYX * (inV.X - RX) + MYY * (inV.Y - RY) + TY + RY; v.Z = inV.Z + TZ; return(v); }