internal void Add(IEnumerable <Edge> edges, Face onThisFace, double arrowsize, System.Drawing.Color clr, int debugHint) { Random rnd = new Random(); foreach (Edge edg in edges) { if (edg.Curve2D(onThisFace) == null) { continue; } int dbgh = debugHint; if (debugHint == -1) { dbgh = edg.GetHashCode(); } Add(edg.Curve2D(onThisFace), clr, dbgh); // noch einen Richtungspfeil zufügen GeoPoint2D[] arrowpnts = new GeoPoint2D[3]; double pos = 0.3 + rnd.NextDouble() * 0.4; // to have different positions when the same curve is displayed twice GeoVector2D dir = edg.Curve2D(onThisFace).DirectionAt(pos).Normalized; arrowpnts[1] = edg.Curve2D(onThisFace).PointAt(pos); arrowpnts[0] = arrowpnts[1] - arrowsize * dir + arrowsize * dir.ToLeft(); arrowpnts[2] = arrowpnts[1] - arrowsize * dir + arrowsize * dir.ToRight(); Polyline2D pl2d = new Polyline2D(arrowpnts); Add(pl2d, clr, edg.GetHashCode()); } }
/// <summary> /// Overrides <see cref="CADability.Curve2D.GeneralCurve2D.TangentPointsToAngle (GeoVector2D)"/> /// </summary> /// <param name="direction"></param> /// <returns></returns> public override double[] TangentPointsToAngle(GeoVector2D direction) { double[] res = new double[2]; res[0] = direction.ToRight().Angle.Radian / (Math.PI * 2); res[1] = direction.ToLeft().Angle.Radian / (Math.PI * 2); return(res); }
/// <summary> /// Overrides <see cref="CADability.Curve2D.GeneralCurve2D.TangentPointsToAngle (GeoVector2D)"/> /// </summary> /// <param name="direction"></param> /// <returns></returns> public override double[] TangentPointsToAngle(GeoVector2D direction) { List <double> res = new List <double>(); Angle a = direction.ToRight().Angle; // zwischen 0 und 2*pi if (start.Sweeps(SweepAngle, a)) { res.Add(PositionOf(Center + direction.ToRight())); // radius ist egal für die richtige Lösung } a = direction.ToLeft().Angle; // zwischen 0 und 2*pi if (start.Sweeps(SweepAngle, a)) { res.Add(PositionOf(Center + direction.ToLeft())); // radius ist egal für die richtige Lösung } return(res.ToArray()); }
/// <summary> /// Overrides <see cref="CADability.Curve2D.GeneralCurve2D.DirectionAt (double)"/> /// </summary> /// <param name="Position"></param> /// <returns></returns> public override GeoVector2D DirectionAt(double Position) { GeoVector2D r = (Math.PI * 2.0) * (PointAt(Position) - Center); // introduced factor (31.1.18) because of HelicalSurface, NewtonLineIntersection if (counterClock) { return(r.ToLeft()); } else { return(r.ToRight()); } }
/// <summary> /// Overrides <see cref="CADability.Curve2D.GeneralCurve2D.DirectionAt (double)"/> /// </summary> /// <param name="Position"></param> /// <returns></returns> public override GeoVector2D DirectionAt(double Position) { GeoVector2D r = (Length / Radius) * (PointAt(Position) - Center); // introduced factor (31.1.18) because of HelicalSurface, NewtonLineIntersection if (sweep > 0.0) { return(r.ToLeft()); } else { return(r.ToRight()); } }
public CurveMovement(ICurve2D c2d, ISurface surface) { this.c2d = c2d; this.surface = surface; GeoVector du, dv; surface.DerivationAt(c2d.StartPoint, out startPos, out du, out dv); GeoVector2D dir2d = c2d.StartDirection; GeoVector2D dir2dr = dir2d.ToRight(); startX = dir2d.x * du + dir2d.y * dv; startZ = du ^ dv; startY = startX ^ startZ; toUnit = (new ModOp(startX, startY, startZ, startPos)).GetInverse(); // in diesem System startet die Kurve im Ursprung in X-Richtung }
internal void Add(IEnumerable <ICurve2D> crvs, double arrowsize, System.Drawing.Color clr, int debugHint) { int i = 0; foreach (ICurve2D crv in crvs) { Add(crv, clr, debugHint); // noch einen Richtungspfeil zufügen GeoPoint2D[] arrowpnts = new GeoPoint2D[3]; GeoVector2D dir = crv.DirectionAt(0.5).Normalized; arrowpnts[1] = crv.PointAt(0.5); arrowpnts[0] = arrowpnts[1] - arrowsize * dir + arrowsize * dir.ToLeft(); arrowpnts[2] = arrowpnts[1] - arrowsize * dir + arrowsize * dir.ToRight(); Polyline2D pl2d = new Polyline2D(arrowpnts); Add(pl2d, clr, debugHint * 100 + i); ++i; } }