private bool IsCoincidentWithCurve(IEntity curve, ref PointOn pOn, IEntity exclude) { for (int i = 0; i < usedInConstraints.Count; i++) { var c = usedInConstraints[i] as PointOn; if (c == null) { continue; } if (c.on.IsSameAs(curve)) { pOn = c; return(true); } } for (int i = 0; i < usedInConstraints.Count; i++) { var c = usedInConstraints[i] as PointsCoincident; if (c == null) { continue; } var p = c.GetOtherPoint(this); PointOn pOn1 = null; if (!p.IsSameAs(exclude) && p is PointEntity && (p as PointEntity).IsCoincidentWithCurve(curve, ref pOn1, this)) { pOn = pOn1; return(true); } } return(false); }
bool IsCoincident(ref double tv0, ref double tv1, ref Exp c, ref Param p) { var l0 = GetEntity(0); var l1 = GetEntity(1); var s0 = l0 as ISegmentaryEntity; var s1 = l1 as ISegmentaryEntity; if (s0 != null && s1 != null) { if (s0.begin.IsCoincidentWith(s1.begin)) { tv0 = 0.0; tv1 = 0.0; return(true); } if (s0.begin.IsCoincidentWith(s1.end)) { tv0 = 0.0; tv1 = 1.0; return(true); } if (s0.end.IsCoincidentWith(s1.begin)) { tv0 = 1.0; tv1 = 0.0; return(true); } if (s0.end.IsCoincidentWith(s1.end)) { tv0 = 1.0; tv1 = 1.0; return(true); } } if (s0 != null) { PointOn pOn = null; if (s0.begin.IsCoincidentWithCurve(l1, ref pOn)) { tv0 = 0.0; p = t1; c = new Exp(t1) - pOn.GetValueParam(); return(true); } if (s0.end.IsCoincidentWithCurve(l1, ref pOn)) { tv0 = 1.0; p = t1; c = new Exp(t1) - pOn.GetValueParam(); return(true); } } if (s1 != null) { PointOn pOn = null; if (s1.begin.IsCoincidentWithCurve(l0, ref pOn)) { p = t0; c = new Exp(t0) - pOn.GetValueParam(); tv1 = 0.0; return(true); } if (s1.end.IsCoincidentWithCurve(l0, ref pOn)) { p = t0; c = new Exp(t0) - pOn.GetValueParam(); tv1 = 1.0; return(true); } } return(false); }
protected override void OnMouseDown(Vector3 pos, ICADObject sko) { if (current != null) { if (!canCreate) { return; } current.c.isSelectable = true; current.isSelectable = true; for (double t = 0.0; t < 1.0; t += 0.25) { var p = new PointEntity(editor.currentSketch.GetSketch()); current.AddChild(p); var pc = new PointOn(editor.currentSketch.GetSketch(), p, current); pc.reference = false; pc.SetValue(t); pc.isVisible = false; p.pos = current.PointOn(t).Eval(); } current = null; return; } if (DetailEditor.instance.currentSketch == null) { return; } editor.PushUndo(); current = new EllipseEntity(DetailEditor.instance.currentSketch.GetSketch()); current.center.pos = pos; AutoConstrainCoincident(current.center, sko as IEntity); current.isSelectable = false; current.c.isSelectable = false; }
protected override void OnMouseDown(Vector3 pos, ICADObject ico) { IEntity entity = ico as IEntity; if (entity == null) { return; } if (p0 != null) { if (entity.type != IEntityType.Point) { editor.PushUndo(); var pOn = new PointOn(DetailEditor.instance.currentSketch.GetSketch(), p0, entity); pOn.reference = false; pOn.SetValue(0.5); } p0 = null; } else if (entity.type == IEntityType.Point) { p0 = entity; } }
public bool IsCoincidentWithCurve(IEntity curve, ref PointOn pOn) { return(IsCoincidentWithCurve(curve, ref pOn, null)); }