public void Add(ICurve2D c2d) { IGeoObject go = c2d.MakeGeoObject(Plane.XYPlane); AssertColor(go); toShow.Add(go); }
private bool Recalc() { Plane pl; GeoPoint2D lotPoint = new GeoPoint2D(0.0, 0.0); if (Curves.GetCommonPlane(distPoint, distCurve, out pl)) { ICurve2D curve_2D = distCurve.GetProjectedCurve(pl); // die 2D-Kurve if (curve_2D is Path2D) { (curve_2D as Path2D).Flatten(); } GeoPoint2D distPoint2D = pl.Project(distPoint); GeoPoint2D[] perpP = curve_2D.PerpendicularFoot(distPoint2D); // Lotpunkt(e) Kurve double distCP = double.MaxValue; for (int j = 0; j < perpP.Length; ++j) // Schleife über alle Lotpunkte Kurve { double distLoc = Geometry.Dist(perpP[j], distPoint2D); if (distLoc < distCP) { distCP = distLoc; lotPoint = perpP[j]; // Lotpunkt schonmal merken } } if (distCP < double.MaxValue) { feedBackLine.SetTwoPoints(distPoint, pl.ToGlobal(lotPoint)); if (!feedBackAdd) { base.FeedBack.Add(feedBackLine); feedBackAdd = true; } actualLength = Geometry.Dist(distPoint, pl.ToGlobal(lotPoint)); secondPoint = pl.ToGlobal(lotPoint); using (Frame.Project.Undo.ContextFrame(this)) { if (lengthProperty != null) { lengthProperty.SetLength(actualLength); } } return(true); } } if (feedBackAdd) { base.FeedBack.Remove(feedBackLine); feedBackAdd = false; } using (Frame.Project.Undo.ContextFrame(this)) { if (lengthProperty != null) { lengthProperty.SetLength(cancelLength); } } actualLength = 0; return(false); }
private bool showLine() { // Linie ist nicht senkrecht auf der ActiveDrawingPlane: if (!Precision.SameDirection(base.ActiveDrawingPlane.Normal, iCurve.StartDirection, false)) { // Ebene senkrecht auf ActiveDrawingPlane und Linie base.MultiSolutionCount = 2; Plane pl = new Plane(iCurve.StartPoint, iCurve.StartDirection, (base.ActiveDrawingPlane.Normal ^ iCurve.StartDirection)); ICurve2D l2D = iCurve.GetProjectedCurve(pl); if (l2D is Path2D) { (l2D as Path2D).Flatten(); } ICurve2D l2DP; if (nextSol) { l2DP = l2D.Parallel(parallelDist, false, 0.0, 0.0); } else { l2DP = l2D.Parallel(-parallelDist, false, 0.0, 0.0); } line.SetTwoPoints(pl.ToGlobal(l2DP.StartPoint), pl.ToGlobal(l2DP.EndPoint)); // Ebene senkrecht auf der Parallelen-Ebene Plane plDist = new Plane(iCurve.StartPoint, pl.Normal, iCurve.StartDirection); lengthInput.SetDistanceFromPlane(plDist); base.ShowActiveObject = true; return(true); } base.MultiSolutionCount = 0; base.ShowActiveObject = false; return(false); }
public CurveSweepMesh(int n, int m, IPath3D path, ICurve2D curve) : base(n, m) { var vectorY = Helper.CreateVector(0, 1, 0); for (int i = 0; i < n; i++) { double u = i * 1.0 / n; path.GetPoint(u, out var x0, out var y0, out var z0); path.GetPoint(u + 0.001, out var x1, out var y1, out var z1); var tgt = Helper.CreateVector(x1 - x0, y1 - y0, z1 - z0); var rotation = Helper.Rotation(vectorY, tgt.Normalize()); for (int j = 0; j < m; j++) { double v = j * 1.0 / m; curve.GetPoint(u, v, out double cx, out double cy); var transformPoint = rotation * Helper.CreateVector(cx, 0, cy); double x = x0 + transformPoint.X; double y = y0 + transformPoint.Y; double z = z0 + transformPoint.Z; Points[i][j] = Helper.CreatePoint(x, y, z); } } }
/// <summary> /// Overrides <see cref="CADability.Curve2D.GeneralCurve2D.Copy (ICurve2D)"/> /// </summary> /// <param name="toCopyFrom"></param> public override void Copy(ICurve2D toCopyFrom) { Polyline2D c = toCopyFrom as Polyline2D; this.vertex = (GeoPoint2D[])c.vertex.Clone(); UserData.CloneFrom(c.UserData); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.ISurfaceImpl.Make3dCurve (ICurve2D)"/> /// </summary> /// <param name="curve2d"></param> /// <returns></returns> public override ICurve Make3dCurve(ICurve2D curve2d) { if (curve2d is ProjectedCurve pc) { if (pc.Surface is RuledSurface) { BoundingRect otherBounds = new BoundingRect(PositionOf(pc.Surface.PointAt(pc.StartPoint)), PositionOf(pc.Surface.PointAt(pc.EndPoint))); if (pc.Surface.SameGeometry(pc.GetExtent(), this, otherBounds, Precision.eps, out ModOp2D notneeded)) { return(pc.Curve3DFromParams); // if trimmed or reversed still returns the correct 3d curve (but trimmed and/or reversed) } } } if (curve2d is Line2D) { Line2D l2d = curve2d as Line2D; if (Math.Abs(l2d.StartPoint.y - l2d.EndPoint.y) < 1e-10) { // wir sind hier im 0..1 Raum return(FixedV(l2d.StartPoint.y, l2d.StartPoint.x, l2d.EndPoint.x)); } else if (Math.Abs(l2d.StartPoint.x - l2d.EndPoint.x) < 1e-10) { return(FixedU(l2d.StartPoint.x, l2d.StartPoint.y, l2d.EndPoint.y)); } } return(base.Make3dCurve(curve2d)); }
private void PerpFoot() { if (dimCurve != null) //falls in CurveInput (s.u.) ein Objekt getroffen war { Plane pl; double mindist = double.MaxValue; GeoPoint2D footPoint = new GeoPoint2D(0.0, 0.0); if (Curves.GetCommonPlane(dim.DimLineRef, dimCurve, out pl)) { ICurve2D c2D = dimCurve.GetProjectedCurve(pl); if (c2D is Path2D) { (c2D as Path2D).Flatten(); } GeoPoint2D[] perpPoints = c2D.PerpendicularFoot(pl.Project(dim.DimLineRef)); if (perpPoints.Length > 0) { // eine gültige Kurve ist gefunden for (int j = 0; j < perpPoints.Length; ++j) { double dist = Geometry.Dist(perpPoints[j], pl.Project(dim.DimLineRef)); if (dist < mindist) { mindist = dist; footPoint = perpPoints[j]; } } } } if (mindist < double.MaxValue) { // also: Fußpunkt gefunden dim.SetPoint(0, pl.ToGlobal(footPoint)); } } }
/// <summary> /// Overrides <see cref="CADability.GeoObject.ISurfaceImpl.PositionOf (GeoPoint)"/> /// </summary> /// <param name="p"></param> /// <returns></returns> public override GeoPoint2D PositionOf(GeoPoint p) { if (basisCurve.GetPlanarState() == PlanarState.Planar) { Plane cp = basisCurve.GetPlane(); // ICurve2D c2d = basisCurve.GetProjectedCurve(cp); wird nicht benötigt if (Precision.IsPerpendicular(cp.Normal, direction, false)) { } else { GeoPoint pp = cp.Intersect(p, direction); // direction darf natürlich nicht in der Ebene der Kurve liegen double u = basisCurve.PositionOf(pp); double v = Geometry.LinePar(basisCurve.PointAt(u), direction, p); #if DEBUG //GeoPoint2D dbg1 = base.PositionOf(p); //GeoPoint2D dbg2 = new GeoPoint2D(curveStartParameter + u * (curveEndParameter - curveStartParameter), v); //if ((dbg1 | dbg2) > 1e-6) //{ // throw new ApplicationException("error in SurfaceOfLinearExtrusion.PositionOf"); //} #endif return(new GeoPoint2D(curveStartParameter + u * (curveEndParameter - curveStartParameter), v)); } } Plane pl = new Plane(basisCurve.StartPoint, direction); ICurve2D projected = basisCurve.GetProjectedCurve(pl); double uu = projected.PositionOf(pl.Project(p)); // assuming the projected curve and the basisCurve have the same parameter space (which is true for NURBS) GeoPoint start = basisCurve.PointAt(uu); double vv = Geometry.LinePar(start, direction, p); return(new GeoPoint2D(uu, vv)); // GeoPoint2D res = base.PositionOf(p); // return res; }
GeoPoint2D ICurveTransformation2D.TransformPoint(ICurve2D curve, double par) { // gesucht: Punkt der Kurve im nichtperiodischen System GeoPoint2D uv = curve.PointAt(par); double r = uv.y - vmin; return(new GeoPoint2D(r * Math.Cos(uv.x), r * Math.Sin(uv.x))); }
private bool Recalc() { if (theBaseCurve == null) { return(false); } Plane pln; if (theBaseCurve.GetPlanarState() == PlanarState.Planar) { pln = theBaseCurve.GetPlane(); } else { pln = base.ActiveDrawingPlane; } ICurve2D c2d = theBaseCurve.GetProjectedCurve(pln); ICurve2D app = c2d.Approximate(false, Frame.GetDoubleSetting("Approximate.Precision", 0.01)); Border bdr = new Border(app); Border[] res = bdr.GetParallel(theDistance, true, 0.0, theMinAngle); Block blk = Block.Construct(); for (int i = 0; i < res.Length; ++i) { IGeoObject go = res[i].AsPath().MakeGeoObject(pln); go.CopyAttributes(theBaseCurve as IGeoObject); (go as IColorDef).ColorDef = (theBaseCurve as IColorDef).ColorDef; blk.Add(go); } base.ActiveObject = blk; return(true); }
void ICurve2D.Copy(ICurve2D toCopyfrom) { Curve2DAspect c = toCopyfrom as Curve2DAspect; theCurve.Copy(c.theCurve); UserData.CloneFrom(c.UserData); }
public override ICurve Make3dCurve(ICurve2D curve2d) { if (curve2d is Line2D && Math.Abs(curve2d.StartPoint.y - curve2d.EndPoint.y) < Precision.eps) { ICurve res = toSweep.CloneModified(modOpAt(curve2d.StartPoint.y)); if (curve2d.StartPoint.x < curve2d.EndPoint.x) { res.Trim(curve2d.StartPoint.x, curve2d.EndPoint.x); } else { res.Trim(curve2d.EndPoint.x, curve2d.StartPoint.x); res.Reverse(); } return(res); } if (curve2d is ProjectedCurve pc) { if (pc.Surface is GeneralSweptCurve) { BoundingRect otherBounds = new BoundingRect(PositionOf(pc.Surface.PointAt(pc.StartPoint)), PositionOf(pc.Surface.PointAt(pc.EndPoint))); if (pc.Surface.SameGeometry(pc.GetExtent(), this, otherBounds, Precision.eps, out ModOp2D notneeded)) { return(pc.Curve3DFromParams); // if trimmed or reversed still returns the correct 3d curve (but trimmed and/or reversed) } } } return(base.Make3dCurve(curve2d)); }
private bool showLine() { ArrayList usableCurves = new ArrayList(); double mindist = double.MaxValue; if (tangCurves == null) { return(false); } for (int i = 0; i < tangCurves.Length; ++i) { Plane pl; // Element hat eine Ebene: if (tangCurves[i].GetPlanarState() == PlanarState.Planar) { pl = tangCurves[i].GetPlane(); } else { // Element hat keine Ebene: Eine machen, falls möglich! try { pl = new Plane(tangCurves[i].StartPoint, tangCurves[i].EndPoint, circlePoint); } catch (PlaneException) { break; } } if (Precision.IsPointOnPlane(circlePoint, pl)) { ICurve2D l2D1 = tangCurves[i].GetProjectedCurve(pl); GeoPoint2D[] tangentPoints = Curves2D.TangentCircle(l2D1, pl.Project(circlePoint), circRad); if (tangentPoints.Length > 0) { // eine gültige Lösung ist gefunden usableCurves.Add(tangCurves[i]); // zur lokalen Liste zufügen for (int k = 0; k < tangentPoints.Length; k += 2) { double dist = Geometry.Dist(tangentPoints[k + 1], pl.Project(radiusPoint)); if (dist < mindist) { mindist = dist; selected = usableCurves.Count - 1; // merken, welche Kurve die aktuell benutzte ist // (/ 2) und (* 2), da pro Lösung zwei Punkte geliefert werden int l = (k + 2 * (Math.Abs(selSol) % (tangentPoints.Length / 2))) % tangentPoints.Length; center = tangentPoints[l]; } } } if (mindist < double.MaxValue) { circRadCalc = (Math.Abs(l2D1.Distance(pl.Project(radiusPoint))) + Math.Abs(Geometry.Dist(circlePoint, radiusPoint))) / 2.0; // base.MultiSolution = true; base.MultiSolutionCount = tangentPoints.Length / 2; circ.SetCirclePlaneCenterRadius(pl, pl.ToGlobal(center), circRad); tangCurves = (ICurve[])usableCurves.ToArray(typeof(ICurve)); // überschreibt die eigentliche Liste und wird unten an den Sender zurückgeliefert base.ShowActiveObject = true; return(true); } } } base.MultiSolutionCount = 0; // base.MultiSolution = false; base.ShowActiveObject = false; return(false); }
GeoVector2D ICurveTransformation2D.TransformDeriv1(ICurve2D curve, double par) { // gesucht: Richtung im nicht periodischen System GeoPoint2D uv = curve.PointAt(par); GeoVector2D dir = curve.DirectionAt(par); return(new GeoVector2D(Math.Cos(uv.x) * (dir.y) - Math.Sin(uv.x) * (dir.x) * (uv.y - vmin), Math.Cos(uv.x) * (dir.x) * (uv.y - vmin) + Math.Sin(uv.x) * (dir.y))); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.ISurfaceImpl.Make3dCurve (ICurve2D)"/> /// </summary> /// <param name="curve2d"></param> /// <returns></returns> public override ICurve Make3dCurve(ICurve2D curve2d) { if (curve2d is ProjectedCurve && (curve2d as ProjectedCurve).Surface == this) { return((curve2d as ProjectedCurve).Curve3D); } throw new NotImplementedException(); }
/// <summary> /// Overrides <see cref="CADability.Curve2D.GeneralCurve2D.Copy (ICurve2D)"/> /// </summary> /// <param name="toCopyFrom"></param> public override void Copy(ICurve2D toCopyFrom) { Arc2D c = toCopyFrom as Arc2D; start = c.start; sweep = c.sweep; base.Copy(toCopyFrom); }
/// <summary> /// Overrides <see cref="CADability.Curve2D.GeneralCurve2D.Copy (ICurve2D)"/> /// </summary> /// <param name="toCopyFrom"></param> public override void Copy(ICurve2D toCopyFrom) { Line2D c = toCopyFrom as Line2D; startPoint = c.startPoint; endPoint = c.endPoint; UserData.CloneFrom(c.UserData); }
/// <summary> /// Overrides <see cref="CADability.Curve2D.GeneralCurve2D.Copy (ICurve2D)"/> /// </summary> /// <param name="toCopyFrom"></param> public override void Copy(ICurve2D toCopyFrom) { Circle2D c = toCopyFrom as Circle2D; center = c.center; radius = c.radius; UserData.CloneFrom(c.UserData); }
public DualSurfaceCurve(ICurve curve3D, ISurface surface1, ICurve2D curve2D1, ISurface surface2, ICurve2D curve2D2) { this.curve3D = curve3D; this.surface1 = surface1; this.curve2D1 = curve2D1; this.surface2 = surface2; this.curve2D2 = curve2D2; }
/// <summary> /// Calculates the intersection points of the two curves. /// </summary> /// <param name="curve1">First curve</param> /// <param name="curve2">Second curve</param> /// <param name="par1">Resulting parameters for the first curve</param> /// <param name="par2">Resulting parameters for the second curve</param> /// <param name="intersection">Three dimensional intersection points</param> /// <returns>Number of intersection points</returns> public static int Intersect(ICurve curve1, ICurve curve2, out double[] par1, out double[] par2, out GeoPoint[] intersection) { // wenn es eine gemeinsame Ebene gibt, dann in dieser Ebene schneiden if (GetCommonPlane(curve1, curve2, out Plane pln)) { ICurve2D c2d1 = curve1.GetProjectedCurve(pln); ICurve2D c2d2 = curve2.GetProjectedCurve(pln); GeoPoint2DWithParameter[] ips = c2d1.Intersect(c2d2); // geht die Parametrierung der projizierten Kurven analog zu den Originalen? // da wir ja nur in die Ebene Projizieren, in der sich duie Kurven ohnehin befinden, müsste das stimmen // das muss aber noch getestet werden par1 = new double[ips.Length]; par2 = new double[ips.Length]; intersection = new GeoPoint[ips.Length]; for (int i = 0; i < ips.Length; ++i) { par1[i] = ips[i].par1; par2[i] = ips[i].par2; intersection[i] = pln.ToGlobal(ips[i].p); } return(ips.Length); } // eine Linie und eine nichtebene Kurve noch gesondert prüfen if (curve1.GetPlanarState() == PlanarState.Planar) { double[] ips = curve2.GetPlaneIntersection(curve1.GetPlane()); List <double> lpar1 = new List <double>(); List <double> lpar2 = new List <double>(); List <GeoPoint> lip = new List <GeoPoint>(); for (int i = 0; i < ips.Length; ++i) { GeoPoint p = curve2.PointAt(ips[i]); double ppar1 = curve1.PositionOf(p); GeoPoint p1 = curve1.PointAt(ppar1); if (Precision.IsEqual(p, p1)) { lpar1.Add(ppar1); lpar2.Add(ips[i]); lip.Add(new GeoPoint(p, p1)); } } par1 = lpar1.ToArray(); par2 = lpar2.ToArray(); intersection = lip.ToArray(); return(par1.Length); } if (curve2.GetPlanarState() == PlanarState.Planar) { return(Intersect(curve2, curve1, out par2, out par1, out intersection)); } // Fehlt noch die Abfrage nach einer Linie, denn die ist ja nicht planar // allgemeiner Fall: zwei nicht ebene Kurven TetraederHull th1 = new TetraederHull(curve1); TetraederHull th2 = new TetraederHull(curve2); return(th1.Intersect(th2, out par1, out par2, out intersection)); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.ISurfaceImpl.FixedU (double, double, double)"/> /// </summary> /// <param name="u"></param> /// <param name="vmin"></param> /// <param name="vmax"></param> /// <returns></returns> public override ICurve FixedU(double u, double vmin, double vmax) { ICurve2D btr = basisCurve2D.Trim(GetPos(vmin), GetPos(vmax)); ICurve b3d = btr.MakeGeoObject(Plane.XYPlane) as ICurve; ModOp rot = ModOp.Rotate(1, (SweepAngle)u); ModOp movePitch = ModOp.Translate(0, pitch * u / (Math.PI * 2.0), 0); return(b3d.CloneModified(toSurface * movePitch * rot)); }
protected CurveMovement(SerializationInfo info, StreamingContext context) { c2d = (ICurve2D)info.GetValue("C2d", typeof(ICurve2D)); surface = (ISurface)info.GetValue("Surface", typeof(ISurface)); startPos = (GeoPoint)info.GetValue("StartPos", typeof(GeoPoint)); startX = (GeoVector)info.GetValue("StartX", typeof(GeoVector)); startY = (GeoVector)info.GetValue("StartY", typeof(GeoVector)); startZ = (GeoVector)info.GetValue("StartZ", typeof(GeoVector)); }
/// <summary> /// Overrides <see cref="CADability.Curve2D.GeneralCurve2D.Intersect (ICurve2D)"/> /// </summary> /// <param name="IntersectWith"></param> /// <returns></returns> public override GeoPoint2DWithParameter[] Intersect(ICurve2D IntersectWith) { GeoPoint2DWithParameter[] res = base.Intersect(IntersectWith); for (int i = 0; i < res.Length; ++i) { res[i].par1 = PositionOf(res[i].p); } return(res); }
public MaterialInterface2D(ICurve2D geometry) { this.Discontinuity = geometry; this.enrichmentFunction = new RampFunction2D(); this.Dofs = new EnrichedDof[] { new EnrichedDof(enrichmentFunction, StructuralDof.TranslationX), new EnrichedDof(enrichmentFunction, StructuralDof.TranslationY) }; this.ElementIntersections = new Dictionary <XContinuumElement2D, CartesianPoint[]>(); }
private double pitch; // pitch in y direction relative to basisCurve2D // ACHTUNG: Achse und Kurve müssen in einer Ebene liegen, damit dieses Objekt mit seinem // OCas Partner kompatibel ist! internal HelicalSurface(ICurve2D basisCurve2D, double pitch, ModOp toSurface, double curveStartParameter, double curveEndParameter, double curveParameterOffset) : base() { this.basisCurve2D = basisCurve2D; this.pitch = pitch; this.toSurface = toSurface; this.fromSurface = toSurface.GetInverse(); this.curveStartParameter = curveStartParameter; this.curveEndParameter = curveEndParameter; this.curveParameterOffset = curveParameterOffset; }
/// <summary> /// Overrides <see cref="CADability.Curve2D.GeneralCurve2D.GetFused (ICurve2D, double)"/> /// </summary> /// <param name="toFuseWith"></param> /// <param name="precision"></param> /// <returns></returns> public override ICurve2D GetFused(ICurve2D toFuseWith, double precision) { if (toFuseWith is Ellipse2D && !(toFuseWith is EllipseArc2D)) { return(toFuseWith.GetFused(this, precision)); } if (toFuseWith is EllipseArc2D) { EllipseArc2D a2d = (toFuseWith as EllipseArc2D); // hier wird vorausgesetzt, dass majrad>minrad immer gilt. Stimmt das? if ((Center | a2d.Center) + Math.Abs(majrad - a2d.majrad) + Math.Abs(minrad - a2d.minrad) < precision) { // alle zusammen kleiner als precision, vielleich beim Bogen zu streng // weitere Bedingung: Achsen müssen übereinstimmen. // dazu müsste man bei vertauschten Richtungen noch mehr Grips reinstecken... EllipseArc2D a1, a2; if (Math.Abs(this.sweepPar) > Math.Abs(a2d.sweepPar)) { a1 = this; a2 = a2d; } else { a1 = a2d; a2 = this; } if (a1.sweepPar * a2.sweepPar < 0.0) { a2.Reverse(); } // a1 ist länger als a2. Wenn es verschmelzen soll, dann muss der Start- oder der Endpunkt von a2 // innerhalb von a1 liegen // Mittelpunkt und radius ist ja schon getestet double pos1 = a1.PositionOf(a2.StartPoint); // vor dem Anfang oder auf dem Bogen double pos2 = a1.PositionOf(a2.EndPoint); // nach dem Ende oder auf dem Bogen // System.Diagnostics.Trace.WriteLine("pos1, pos2: " + pos1.ToString() + ", " + pos2.ToString()); bool pos1ok = a1.IsParameterOnCurve(pos1); bool pos2ok = a1.IsParameterOnCurve(pos2); if (pos1ok && pos2ok) { // beide Punkte sind drauf return(a1.Clone()); } else if (pos1ok) { return(Create(a1.center, a1.majorAxis, a1.minorAxis, a1.startPoint, a2.endPoint, a1.sweepPar > 0.0)); } else if (pos2ok) { return(Create(a1.center, a1.majorAxis, a1.minorAxis, a2.startPoint, a1.endPoint, a1.sweepPar > 0.0)); } } } return(null); }
/// <summary> /// Overrides <see cref="CADability.GeoObject.ISurfaceImpl.HitTest (BoundingCube, out GeoPoint2D)"/> /// </summary> /// <param name="bc"></param> /// <param name="uv"></param> /// <returns></returns> public override bool HitTest(BoundingCube bc, out GeoPoint2D uv) { Plane p = new Plane(GeoPoint.Origin, direction); PlaneSurface ps = new PlaneSurface(p); ICurve2D c = basisCurve.GetProjectedCurve(p); GeoPoint[] points = bc.Points; GeoPoint2D[] points2D = new GeoPoint2D[8]; for (int i = 0; i < 8; ++i) { points2D[i] = ps.PositionOf(points[i]); } // does c hit the polygon? int[,] l = bc.LineNumbers; for (int k = 0; k < 12; ++k) { int i = l[k, 0]; int j = l[k, 1]; ICurve2D c2 = new Line2D(points2D[i], points2D[j]); if (c2.Length > 0) { GeoPoint2DWithParameter[] list = c.Intersect(c2); for (int m = 0; m < list.Length; ++m) { GeoPoint2D d0 = list[m].p; double d1 = (points2D[i] - d0).Length; double d2 = (points2D[j] - d0).Length; double d3 = (points2D[i] - points2D[j]).Length; if (Math.Abs(d1 + d2 - d3) < Precision.eps) { if (d3 < Precision.eps) { throw new Exception(); } GeoPoint gp = points[i] + (d1 / d3) * (points[j] - points[i]); uv = PositionOf(gp); return(true); } } } } // is c in the polygon? GeoPoint e = ps.PointAt(c.EndPoint); bool res = (bc.Interferes(e, direction, bc.Size * 1e-8, false)); if (res) { // nur berechnen, wenn auch gültig uv = PositionOf(e); } else { uv = GeoPoint2D.Origin; } return(res); }
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) { IDebugForm form = CF.DebugForm; Model m = form.Model; ICurve2D gc2d = (ICurve2D)objectProvider.GetObject(); m.Add(VisualizerHelper.AssertColor(gc2d.MakeGeoObject(Plane.XYPlane))); form.ShowDialog(windowService); }
public override void Copy(ICurve2D toCopyFrom) { SineCurve2D other = toCopyFrom as SineCurve2D; if (other is SineCurve2D) { ustart = other.ustart; udiff = other.udiff; fromUnit = other.fromUnit; } }
/// <summary> /// Overrides <see cref="CADability.Curve2D.GeneralCurve2D.CloneReverse (bool)"/> /// </summary> /// <param name="reverse"></param> /// <returns></returns> public override ICurve2D CloneReverse(bool reverse) { ICurve2D res = this.Clone(); if (reverse) { res.Reverse(); } res.UserData.CloneFrom(this.UserData); return(res); }