private void Controller_ThrottleLeft(object sender, ThrottleAxisEventArgs e) { if (LeftEnabled) { int z = e.AxisValue * 2; this.tmThrottleController.VisualState.UpdateAxis1((UInt32)z); // for this curve we want the top and bottom of the throttle to be the full multiplier // The middle is where it will damper the movement // Shift the value down to -16k to +16K int shifted_value = z - (1024 * 16); // .2 makes a good dead zone in the middle of the throttle shifted_value = Curves.Calculate(shifted_value, (16 * 1024), .2); // Move the value back up z = shifted_value + (1024 * 16); tmThrottleController.SetJoystickAxis(z, HID_USAGES.HID_USAGE_RZ, vJoyTypes.Throttle); } }
protected virtual void Create(CarriageWay carriageWay, RoadCentreLine centreLine) { var db = Application.DocumentManager.MdiActiveDocument.Database; var acTrans = TransactionFactory.CreateFromTop(); var blockTable = (BlockTable)acTrans.GetObject(db.BlockTableId, OpenMode.ForRead); var blockTableRecord = (BlockTableRecord)acTrans.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite); var offsetDist = DistanceFromCarriageWay(carriageWay); foreach (ObjectId obj in carriageWay.Curves.Collection) { var entity = acTrans.GetObject(obj, OpenMode.ForRead) as Entity; if (entity is Curve curve) { var curveOffset = curve.CreateOffset(Side, offsetDist); if (curveOffset != null) { curveOffset.Layer = Constants.LAYER_DEF_POINTS; Curves.Add(blockTableRecord.AppendEntity(curveOffset)); acTrans.AddNewlyCreatedDBObject(curveOffset, true); } } } }
// Update is called once per frame void Update() { if (moveTimer > 0 && transformToMove != null) { moveTimer -= Time.deltaTime; float t = (moveTime - moveTimer) / moveTime; transformToMove.position = Curves.LerpTranslation(points, t); if (autoTurning) { if (moveTransformDir != null) { transformToMove.localRotation = Curves.LerpOrientation(points, t) * moveTransformDir.rotation; } else { transformToMove.localRotation = Curves.LerpOrientation(points, t); } } if (moveTimer <= 0 && looping) { ResetMove(); } } }
protected virtual IXPoint GetPoint(bool isStart) { var curve = isStart ? Curves.First() : Curves.Last(); if (curve.IsTrimmedCurve()) { if (curve.GetEndParams(out double start, out double end, out _, out _)) { var pt = curve.Evaluate2(isStart ? start : end, 1) as double[]; return(new SwPoint() { Coordinate = new Point(pt[0], pt[1], pt[2]) }); } else { throw new Exception("Failed to get end parameters of curve"); } } else { throw new NotSupportedException("Only trimmed curves are supported"); } }
virtual public bool OnCommand(string MenuId) { switch (MenuId) { case "MenuId.Reverse": (bSpline as ICurve).Reverse(); ReloadProperties(); //polesProperty.ShowOpen(false); //if (throughPointsProperty!=null) throughPointsProperty.ShowOpen(false); return(true); case "MenuId.CurveSplit": Frame.SetAction(new ConstrSplitCurve(bSpline)); return(true); case "MenuId.Approximate": if (Frame.ActiveAction is SelectObjectsAction) { Curves.Approximate(Frame, bSpline); } return(true); } return(false); }
public Animation(FBXFile file, List <string> bones) { var rawNodes = file.GetAnimationCurveNodes(); var rawCurves = file.GetAnimationCurves(); // first: expand AnimationCurveNode into curve nodes var curveNodes = new List <FBXAnimCurveNode>(); foreach (var tempNode in rawNodes) { var fileNode = file.FindChild(tempNode.Id); curveNodes.Add(new FBXAnimCurveNode(fileNode, file, bones)); } // second: gen dict, mapped by internalId var tmp = new Dictionary <long, FBXAnimCurveNode>(); for (var i = 0; i < curveNodes.Count; ++i) { tmp.Add(curveNodes[i].Id, curveNodes[i]); } // third: insert curves into the dict var ac = new List <FBXAnimCurve>(); var max = 0f; foreach (var curve in rawCurves) { ac.Add(curve); max = curve.Length > max ? curve.Length : max; var parentId = file.Connections.Where(a => a.Src == curve.Id).FirstOrDefault().Dst; var axis = file.GetConnectionType(curve.Id, parentId); if (axis.Contains("X")) { axis = "x"; } if (axis.Contains("Y")) { axis = "y"; } if (axis.Contains("Z")) { axis = "z"; } tmp[parentId].Curves.Add(axis, curve); } // forth: foreach (var t in tmp) { var id = t.Value.ContainerBoneId; if (!Curves.ContainsKey(id)) { Curves.Add(id, new Dictionary <string, FBXAnimCurveNode>()); } if (Curves[id].ContainsKey(t.Value.Attr)) { Curves[id][t.Value.Attr] = t.Value; } else { Curves[id].Add(t.Value.Attr, t.Value); } } Length = max; Frames = Length * FPS; }
IEnumerator IEnumerable.GetEnumerator() { return(Curves.GetEnumerator()); }
virtual public bool OnCommand(string MenuId) { switch (MenuId) { case "MenuId.Reverse": (path as ICurve).Reverse(); if (propertyPage != null) { propertyPage.Refresh(this); } return(true); case "MenuId.CurveSplit": Frame.SetAction(new ConstrSplitCurve(path)); return(true); case "MenuId.Approximate": if (Frame.ActiveAction is SelectObjectsAction) { Curves.Approximate(Frame, path); } return(true); case "MenuId.Explode": if (Frame.ActiveAction is SelectObjectsAction) { using (Frame.Project.Undo.UndoFrame) { IGeoObjectOwner addTo = path.Owner; if (addTo == null) { addTo = Frame.ActiveView.Model; } ICurve[] pathCurves = path.Curves; GeoObjectList toSelect = path.Decompose(); addTo.Remove(path); for (int i = toSelect.Count - 1; i >= 0; --i) { if (!toSelect[i].HasValidData()) { toSelect.Remove(i); } } for (int i = 0; i < toSelect.Count; i++) { addTo.Add(toSelect[i]); } SelectObjectsAction soa = Frame.ActiveAction as SelectObjectsAction; soa.SetSelectedObjects(toSelect); // alle Teilobjekte markieren } } return(true); case "MenuId.Aequidist": Frame.SetAction(new ConstructAequidist(path)); return(true); case "MenuId.Reduce": if (path.GetPlanarState() == PlanarState.Planar) { Plane pln = path.GetPlane(); Path2D p2d = path.GetProjectedCurve(pln) as Path2D; if (p2d != null) { p2d.ForceConnected(); Reduce2D r2d = new Reduce2D(); r2d.Precision = Settings.GlobalSettings.GetDoubleValue("Approximate.Precision", 0.01); r2d.Add(p2d.SubCurves); r2d.OutputMode = Reduce2D.Mode.Paths; ICurve2D[] red = r2d.Reduced; if (red.Length == 1) { using (Frame.Project.Undo.UndoFrame) { IGeoObjectOwner addTo = path.Owner; if (addTo == null) { addTo = Frame.ActiveView.Model; } addTo.Remove(path); Path redpath = red[0].MakeGeoObject(pln) as Path; if (redpath != null) { SelectObjectsAction soa = Frame.ActiveAction as SelectObjectsAction; soa.SetSelectedObjects(new GeoObjectList(redpath)); } } } } } return(true); } return(false); }
/// <summary> /// Initialize data /// </summary> /// <param name="userManager"></param> /// <param name="roleManager"></param> /// <param name="token"></param> /// <returns></returns> public async Task InitializeDatabaseAsync( UserManager <User> userManager, RoleManager <UserRole> roleManager, CancellationToken token = default) { await Database.EnsureCreatedAsync(); if (await roleManager.FindByNameAsync("ROOT") == null) { await roleManager.CreateAsync(new UserRole { Name = "ROOT", NormalizedName = "ROOT" }); } if (await roleManager.FindByNameAsync("COMMONUSER") == null) { await roleManager.CreateAsync(new UserRole { Name = "COMMONUSER", NormalizedName = "COMMONUSER" }); } if (await userManager.FindByNameAsync("root") == null) { var user = new User { UserName = "******" }; await userManager.CreateAsync(user, "123456"); await userManager.AddToRoleAsync(user, "ROOT"); } for (var i = 1; i <= 10; i++) { var userName = "******" + i; if (await userManager.FindByNameAsync(userName) == null) { var user = new User { UserName = userName }; await userManager.CreateAsync(user, "123456"); await userManager.AddToRoleAsync(user, "COMMONUSER"); } } if (!await Curves.AnyAsync(x => x.Id == "bancor", token)) { Curves.Add(new Curve { Id = "bancor", PriceSupplyFunction = "${supply} * (pow((1 + (x - ${balance}) / ${balance}),${cw}) - 1) + ${supply}", BalanceSupplyFunction = "x / ((${supply} * (pow((1 + (x - ${balance}) / ${balance}),${cw}) - 1) + ${supply}) * ${cw})", Description = "", Arguments = JsonConvert.SerializeObject(new List <CurveArgument> { new CurveArgument { Id = "supply", ControlType = CurveArgumentControlType.Input, Name = "Initial Supply (Token)" }, new CurveArgument { Id = "balance", ControlType = CurveArgumentControlType.Input, Name = "Initial Balance (EOS)" }, new CurveArgument { Id = "cw", ControlType = CurveArgumentControlType.Slider, Name = "Reserve Ratio" } }) }); await SaveChangesAsync(); } if (!await Curves.AnyAsync(x => x.Id == "daibo", token)) { Curves.Add(new Curve { Id = "daibo", PriceSupplyFunction = "${k} * x", BalanceSupplyFunction = "${k}/2 * x^2", SupplyBalanceFunction = "(2/${k})^(0.5) * x^(0.5)", PriceBalanceFunction = "((2/${k})^(0.5) * x^(0.5)) * ${k}", Description = "", Arguments = JsonConvert.SerializeObject(new List <CurveArgument> { new CurveArgument { Id = "k", ControlType = CurveArgumentControlType.Slider, Name = "Increase Ratio" } }) }); await SaveChangesAsync(); } if (!await Constants.AnyAsync(x => x.Id == "action_pos", token)) { Constants.Add(new Constant { Id = "action_pos", Value = "-1" }); await SaveChangesAsync(); } }
private static void AddCurveToBone(AnimatedBone[] bones, int boneId, Curves.CurveBase curve) { if (boneId < 0 || boneId >= bones.Length) { throw new ArgumentOutOfRangeException("boneId"); } AnimatedBone bone = bones[boneId]; if (bone == null) { bone = new AnimatedBone(); bone.BoneId = boneId; bones[boneId] = bone; } switch (curve.AnimatedComponent) { case AnimatedComponent.Quaternion: { if (bone.RotationCurve != null) { throw new InvalidOperationException("Two rotation curves for a bone?"); } var qCurve = curve as Curves.QuaternionCurve; if (qCurve == null) { throw new InvalidOperationException("Curve is not a quaternion curve?"); } bone.RotationCurve = qCurve; } break; case AnimatedComponent.TranslationX: { if (bone.TranslationX != null) { throw new InvalidOperationException("Two TranslationX curves for a bone?"); } var fCurve = curve as Curves.Curve<float>; if (fCurve == null) { throw new InvalidOperationException("Curve is not a Curve<float>"); } bone.TranslationX = fCurve; } break; case AnimatedComponent.TranslationY: { if (bone.TranslationY != null) { throw new InvalidOperationException("Two TranslationY curves for a bone?"); } var fCurve = curve as Curves.Curve<float>; if (fCurve == null) { throw new InvalidOperationException("Curve is not a Curve<float>"); } bone.TranslationY = fCurve; } break; case AnimatedComponent.TranslationZ: { if (bone.TranslationZ != null) { throw new InvalidOperationException("Two TranslationZ curves for a bone?"); } var fCurve = curve as Curves.Curve<float>; if (fCurve == null) { throw new InvalidOperationException("Curve is not a Curve<float>"); } bone.TranslationZ = fCurve; } break; case AnimatedComponent.ScaleX: { if (bone.ScaleX != null) { throw new InvalidOperationException("Two ScaleX curves for a bone?"); } var fCurve = curve as Curves.Curve<float>; if (fCurve == null) { throw new InvalidOperationException("Curve is not a Curve<float>"); } bone.ScaleX = fCurve; } break; case AnimatedComponent.ScaleY: { if (bone.ScaleY != null) { throw new InvalidOperationException("Two ScaleY curves for a bone?"); } var fCurve = curve as Curves.Curve<float>; if (fCurve == null) { throw new InvalidOperationException("Curve is not a Curve<float>"); } bone.ScaleY = fCurve; } break; case AnimatedComponent.ScaleZ: { if (bone.ScaleZ != null) { throw new InvalidOperationException("Two ScaleZ curves for a bone?"); } var fCurve = curve as Curves.Curve<float>; if (fCurve == null) { throw new InvalidOperationException("Curve is not a Curve<float>"); } bone.ScaleZ = fCurve; } break; } }
/// <summary> /// Decompose graph into simple polylines and polygons. /// </summary> public static Curves ExtractCurves(DGraph2 graph) { Curves c = new Curves(); c.Loops = new List <Polygon2d>(); c.Paths = new List <PolyLine2d>(); HashSet <int> used = new HashSet <int>(); // find boundary and junction vertices HashSet <int> boundaries = new HashSet <int>(); HashSet <int> junctions = new HashSet <int>(); foreach (int vid in graph.VertexIndices()) { if (graph.IsBoundaryVertex(vid)) { boundaries.Add(vid); } if (graph.IsJunctionVertex(vid)) { junctions.Add(vid); } } // walk paths from boundary vertices foreach (int start_vid in boundaries) { int vid = start_vid; int eid = graph.GetVtxEdges(vid)[0]; if (used.Contains(eid)) { continue; } PolyLine2d path = new PolyLine2d(); path.AppendVertex(graph.GetVertex(vid)); while (true) { used.Add(eid); Index2i next = NextEdgeAndVtx(eid, vid, graph); eid = next.a; vid = next.b; path.AppendVertex(graph.GetVertex(vid)); if (boundaries.Contains(vid) || junctions.Contains(vid)) { break; // done! } } c.Paths.Add(path); } // ok we should be done w/ boundary verts now... boundaries.Clear(); foreach (int start_vid in junctions) { foreach (int outgoing_eid in graph.VtxEdgesItr(start_vid)) { if (used.Contains(outgoing_eid)) { continue; } int vid = start_vid; int eid = outgoing_eid; PolyLine2d path = new PolyLine2d(); path.AppendVertex(graph.GetVertex(vid)); while (true) { used.Add(eid); Index2i next = NextEdgeAndVtx(eid, vid, graph); eid = next.a; vid = next.b; path.AppendVertex(graph.GetVertex(vid)); if (eid == int.MaxValue || junctions.Contains(vid)) { break; // done! } } c.Paths.Add(path); } } // all that should be left are continuous loops... foreach (int start_eid in graph.EdgeIndices()) { if (used.Contains(start_eid)) { continue; } int eid = start_eid; Index2i ev = graph.GetEdgeV(eid); int vid = ev.a; Polygon2d poly = new Polygon2d(); poly.AppendVertex(graph.GetVertex(vid)); while (true) { used.Add(eid); Index2i next = NextEdgeAndVtx(eid, vid, graph); eid = next.a; vid = next.b; poly.AppendVertex(graph.GetVertex(vid)); if (eid == int.MaxValue || junctions.Contains(vid)) { throw new Exception("how did this happen??"); } if (used.Contains(eid)) { break; } } poly.RemoveVertex(poly.VertexCount - 1); c.Loops.Add(poly); } return(c); }
//public override void AutoRepeated() //{ // sourceCurve = sourceCurveSave; // sourceCurve auf den Instanzübergreifenden Wert gesetzt //} private bool showObject() { double[] cutPlace; base.FeedBack.ClearSelected(); if ((iCurve2 != null) && !iCurve2.IsClosed && (iCurve1 != null) && !iCurve1.IsClosed && (iCurve1 != iCurve2)) { // Plane pl; // if (Curves.GetCommonPlane(iCurve1, iCurve2, out pl)) // { // ICurve2D curve1_2D = iCurve1.GetProjectedCurve(pl); // die 2D-Kurven // ICurve2D curve2_2D = iCurve2.GetProjectedCurve(pl); // if (curve1_2D is Path2D) (curve1_2D as Path2D).Flatten(); // if (curve2_2D is Path2D) (curve2_2D as Path2D).Flatten(); // // hier die Schnittpunkte bestimmen und den ObjectPoint auf den nächsten Schnittpunt setzen // GeoPoint2DWithParameter[] intersectPoints = curve1_2D.Intersect(curve2_2D); // GeoPoint position = new GeoPoint(objectPoint1, objectPoint2); // double distS = double.MaxValue; // Entfernung des Pickpunkts zu den Schnittpunkten // for (int i = 0; i < intersectPoints.Length; ++i) // { //// double distLoc = Geometry.Dist(intersectPoints[i].p, pl.Project(position)); // double distLoc = Geometry.Dist(intersectPoints[i].p, pl.Project(objectPoint2)); // if (distLoc < distS) // { // distS = distLoc; // param1 = intersectPoints[i].par1; // param2 = intersectPoints[i].par2; // } // } // } cutPlace = Curves.Intersect(iCurve1, iCurve2, false); GeoPoint position = new GeoPoint(objectPoint1, objectPoint2); if (cutPlace.Length > 0) { pos1 = iCurve1.PositionOf(position); // pos1 = iCurve1.PositionOf(objectPoint1); double dist = double.MaxValue; for (int i = 0; i < cutPlace.Length; ++i) { double distLoc = Geometry.Dist(position, iCurve1.PointAt(cutPlace[i])); // double distLoc = Geometry.Dist(objectPoint1, iCurve1.PointAt(cutPlace[i])); if (distLoc < dist) { // dist = Math.Abs(pos1 - cutPlace[i]); dist = distLoc; param1 = cutPlace[i]; // k1 = 2; } } } cutPlace = Curves.Intersect(iCurve2, iCurve1, false); if (cutPlace.Length > 0) { pos2 = iCurve2.PositionOf(position); // pos2 = iCurve2.PositionOf(objectPoint2); double dist = double.MaxValue; for (int i = 0; i < cutPlace.Length; ++i) { double distLoc = Geometry.Dist(position, iCurve2.PointAt(cutPlace[i])); // double distLoc = Geometry.Dist(objectPoint2, iCurve2.PointAt(cutPlace[i])); if (distLoc < dist) { dist = distLoc; param2 = cutPlace[i]; } } } if (!Precision.IsNull(param1) || !Precision.IsNull(param2))// was gefunden { base.FeedBack.ClearSelected(); bool connect = false; if ((param1 > (1 + 1e-8) || param1 < -1e-8)) { // also nur bei realer Verlängerung nach oben oder unten und offen newCurve = iCurve1.Clone(); if (param1 < 0.5) { newCurve.StartPoint = iCurve1.PointAt(param1); } else { newCurve.EndPoint = iCurve1.PointAt(param1); } (newCurve as IGeoObject).CopyAttributes(iCurve1 as IGeoObject); base.FeedBack.AddSelected(newCurve as IGeoObject);// erste Linie einfügen connect = true; } if ((param2 > (1 + 1e-8) || param2 < -1e-8)) { // also nur bei realer Verlängerung nach oben oder unten und offen newCurve = iCurve2.Clone(); if (param2 < 0.5) { newCurve.StartPoint = iCurve2.PointAt(param2); } else { newCurve.EndPoint = iCurve2.PointAt(param2); } (newCurve as IGeoObject).CopyAttributes(iCurve2 as IGeoObject); base.FeedBack.AddSelected(newCurve as IGeoObject);// letzte Linie einfügen connect = true; } if (connect) { return(true); } } } param1 = 0.0; param2 = 0.0; return(false); }
//------------------------------------------------------------------------- internal static ScenarioMarketData marketData() { Curve curve = ConstantCurve.of(Curves.discountFactors("Test", ACT_360), 0.99); return(new TestMarketDataMap(VAL_DATE, ImmutableMap.of(DISCOUNT_CURVE_ID, curve, FORWARD_CURVE_ID, curve), ImmutableMap.of())); }
public void AddNewCurve() { Curves.Add(Curve.Create()); Curves = new List <Curve>(Curves.OrderBy(c => c.Name)); }
public IrCurve GetCurve(string name) => Curves.TryGetValue(name, out var curve) ? curve : throw new Exception($"Curve named {name} not found");
// Start is called before the first frame update void Awake() { Instance = this; }
public static List <Brep> AvailableFloorSpace(List <Brep> floorRegions, TestFitPackage tf, CirculationPackage circ) { //Parse exemption profiles. List <Curve> exemptionCurves = tf.FloorPlanPackage.ExemptionProfiles; List <Brep> exemptionRegions = new List <Brep>(); foreach (Curve exemption in exemptionCurves) { Brep exemptionSurface = Brep.CreatePlanarBreps(exemption)[0]; exemptionRegions.Add(exemptionSurface); } //Remove spaces designated by exemptions. List <Brep> nonExemptRegions = Select.NotExemptRegions(floorRegions, exemptionRegions); //Parse regions of core that need egress and circulation axis. List <Curve> coreAccessCurves = tf.FloorPlanPackage.CoreAccessCurves; List <Curve> circulationCurves = tf.FloorPlanPackage.CirculationAxisCurves; //Remove space for core access and egress requirements. Only if circulation axis do not already connect all egress requirements. List <Curve> coreCurvesToGiveEgress = Select.CoreCurvesWithoutEgress(coreAccessCurves, circulationCurves); if (coreCurvesToGiveEgress.Count != 0) { List <Curve> bestSourceOfEgress = Select.BestSourceOfEgress(coreCurvesToGiveEgress, circulationCurves); List <Brep> newExemptionsForEgress = Select.OrthogonalEgress(coreCurvesToGiveEgress, bestSourceOfEgress); //nonExemptRegions = newExemptionsForEgress; nonExemptRegions = Select.NotExemptRegions(nonExemptRegions, newExemptionsForEgress); } //Remove circulation zones of main circulation items. List <Curve> mainCirculationSegments = circ.MainCurves; List <Brep> circulationExemptions = new List <Brep>(); foreach (Curve segment in mainCirculationSegments) { int minDist = 4; Curve extendedSegment = segment.Extend(CurveEnd.Both, minDist / 2, CurveExtensionStyle.Line); Brep circRegion = Brep.CreatePlanarBreps(Curves.OffsetClosed(extendedSegment, minDist / 2, true))[0]; circulationExemptions.Add(circRegion); } //nonExemptRegions = Select.NotCirculationRegions(nonExemptRegions, circulationExemptions); nonExemptRegions = Select.NotExemptRegions(nonExemptRegions, circulationExemptions); //Remove columns. Still unsure if this is the best move. //Disabled for now, for performance reasons. Maybe check collision on population? List <Curve> structureObstacles = tf.FloorPlanPackage.StructureProfiles; List <Brep> structureExemptions = new List <Brep>(); foreach (Curve str in structureObstacles) { structureExemptions.Add(Brep.CreatePlanarBreps(str)[0]); } //nonExemptRegions = Select.NotExemptRegions(nonExemptRegions, structureExemptions); return(nonExemptRegions); }
public void Handle(DeleteCurveEvent message) { settingsManager.Settings.RemoveCurve(message.CurveViewModel.Curve); Curves.Remove(message.CurveViewModel); }
// Update is called once per frame void Update() { m_lifeTime += Time.deltaTime * accelerationSpeed; transform.Translate(Gravity.GetGravityAt(transform.position) * Curves.QuadEaseIn(0, maxGravityMult, Mathf.Clamp01(m_lifeTime)) * Time.deltaTime, Space.World); }
public Vector3 DerivAt(float u) { return(Curves.CubicHermiteDeriv(begin.position, begin.ForwardScaled(), end.position, end.ForwardScaled(), u)); }
public void OnGUI() { if (Event.current.commandName == "UndoRedoPerformed") { return; } if (Curves == null || Curves.Count == 0) { GUILayout.Box("", TimelineBackground, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true), GUILayout.MaxHeight(MaxHeight)); if (Event.current.type == EventType.Repaint) { DisplayArea = GUILayoutUtility.GetLastRect(); } GUI.Label(DisplayArea, "Press the Animate button to start animating properties!"); return; } if (Curves.Any(curve => curve == null)) { throw new NullReferenceException("One of the curves is null, this shouldn't happen"); } if (EditorWindow == null) { throw new NullReferenceException("Editor Window must be assigned a value"); } if (RebuildCurvesOnNextGUI) { CalculateBounds(); RebuildCachedCurveInformation(); // Sometimes, depending on the update order vs the serialization order, this can be null during Undo / Redo :/ if (EditorWindow != null) { EditorWindow.Repaint(); } } RebuildCurvesOnNextGUI = false; foreach (var cachedRenderingData in cachedKeyframePositions) { if (SelectedObjects.Contains(cachedRenderingData.Key)) { cachedRenderingData.Value.IsKeyframeSelected = true; } else { cachedRenderingData.Value.IsKeyframeSelected = false; } } if (cachedKeyframePositions == null || (cachedKeyframePositions.Count == 0 && Curves.Count > 0)) { RebuildCachedCurveInformation(); } GUILayout.Box("", TimelineBackground, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true), GUILayout.MaxHeight(MaxHeight)); if (Event.current.type == EventType.Repaint) { var displayAreaRect = GUILayoutUtility.GetLastRect(); var previousDisplayArea = DisplayArea; DisplayArea = displayAreaRect; if (DisplayArea != previousDisplayArea) { RebuildCachedCurveInformation(); } } using (new GUIBeginArea(DisplayArea)) { if (Event.current.type == EventType.Repaint) { DrawGrid(); } for (var n = 0; n < Curves.Count; n++) { DrawCurve(Curves[n], AnimationCurveEditorUtility.GetCurveColor(n)); } HandleEvent(); } }
/// <summary> /// Decompose graph into simple polylines and polygons. /// </summary> public static Curves ExtractCurves(DGraph3 graph) { Curves c = new Curves(); c.Loops = new List <DCurve3>(); c.Paths = new List <DCurve3>(); HashSet <int> used = new HashSet <int>(); // find boundary and junction vertices HashSet <int> boundaries = new HashSet <int>(); HashSet <int> junctions = new HashSet <int>(); foreach (int vid in graph.VertexIndices()) { if (graph.IsBoundaryVertex(vid)) { boundaries.Add(vid); } if (graph.IsJunctionVertex(vid)) { junctions.Add(vid); } } // walk paths from boundary vertices foreach (int start_vid in boundaries) { int vid = start_vid; int eid = graph.GetVtxEdges(vid)[0]; if (used.Contains(eid)) { continue; } DCurve3 path = new DCurve3() { Closed = false }; path.AppendVertex(graph.GetVertex(vid)); while (true) { used.Add(eid); Index2i next = NextEdgeAndVtx(eid, vid, graph); eid = next.a; vid = next.b; path.AppendVertex(graph.GetVertex(vid)); if (boundaries.Contains(vid) || junctions.Contains(vid)) { break; // done! } } c.Paths.Add(path); } // ok we should be done w/ boundary verts now... boundaries.Clear(); foreach (int start_vid in junctions) { foreach (int outgoing_eid in graph.VtxEdgesItr(start_vid)) { if (used.Contains(outgoing_eid)) { continue; } int vid = start_vid; int eid = outgoing_eid; DCurve3 path = new DCurve3() { Closed = false }; path.AppendVertex(graph.GetVertex(vid)); while (true) { used.Add(eid); Index2i next = NextEdgeAndVtx(eid, vid, graph); eid = next.a; vid = next.b; path.AppendVertex(graph.GetVertex(vid)); if (eid == int.MaxValue || junctions.Contains(vid)) { break; // done! } } // we could end up back at our start junction vertex! if (vid == start_vid) { path.RemoveVertex(path.VertexCount - 1); path.Closed = true; c.Loops.Add(path); // need to mark incoming edge as used...but is it valid now? //Util.gDevAssert(eid != int.MaxValue); if (eid != int.MaxValue) { used.Add(eid); } } else { c.Paths.Add(path); } } } // all that should be left are continuous loops... foreach (int start_eid in graph.EdgeIndices()) { if (used.Contains(start_eid)) { continue; } int eid = start_eid; Index2i ev = graph.GetEdgeV(eid); int vid = ev.a; DCurve3 poly = new DCurve3() { Closed = true }; poly.AppendVertex(graph.GetVertex(vid)); while (true) { used.Add(eid); Index2i next = NextEdgeAndVtx(eid, vid, graph); eid = next.a; vid = next.b; poly.AppendVertex(graph.GetVertex(vid)); if (eid == int.MaxValue || junctions.Contains(vid)) { throw new Exception("how did this happen??"); } if (used.Contains(eid)) { break; } } poly.RemoveVertex(poly.VertexCount - 1); c.Loops.Add(poly); } return(c); }
/// <summary> /// Distance of a point to a bezier curve(given by the two end points and the two control points). /// </summary> /// <returns> /// Return the square of the distance,and also the closest point on bezier, and the t value coresponding to that closest point. /// </returns> public static float DistPointToBezier(Vector2 point, Vector2 p1, Vector2 c1, Vector2 c2, Vector2 p2, out Vector2 closestPoint, out float closestPointTValue) { //we're going to project the point on the bezier curve,so to know how close it is closestPoint = Vector2.zero; closestPointTValue = 0; Vector2 pointNorm = point; Vector2 p1Norm = p1; Vector2 c1Norm = c1; Vector2 c2Norm = c2; Vector2 p2Norm = p2; //move the whole bezier curve so that the mouse location si translated to the origin p1Norm -= pointNorm; c1Norm -= pointNorm; c2Norm -= pointNorm; p2Norm -= pointNorm; //here are the factors of B(t) Vector2 A = -p1Norm + 3.0F * c1Norm - 3.0F * c2Norm + p2Norm; Vector2 B = 3.0F * p1Norm - 6.0F * c1Norm + 3.0F * c2Norm; Vector2 C = -3.0F * p1Norm + 3.0F * c1Norm; Vector2 D = p1Norm; //calculates the factor of B(t)*B'(t)..this is a 5th degree polynom const int max_degree = 5; int degree = max_degree; //finds the real degree float[] Q = new float[max_degree + 1]; Q[0] = 3.0F * Vector2.Dot(A, A); Q[1] = (5.0F * Vector2.Dot(A, B)); Q[2] = (4.0F * Vector2.Dot(A, C) + 2.0F * Vector2.Dot(B, B)); Q[3] = (3.0F * Vector2.Dot(B, C) + 3.0F * Vector2.Dot(A, D)); Q[4] = (Vector2.Dot(C, C) + 2.0F * Vector2.Dot(B, D)); Q[5] = Vector2.Dot(C, D); const float error = 0.00001f; //accepted error for (int j = 0; j < max_degree; ++j) { //we should consider nil, the very small values if (System.Math.Abs(Q[j]) < error) { degree -= 1; } else { for (int k = j + 1; k < max_degree + 1; ++k) { Q[k] /= Q[j]; } break; } } //get now the 't' value which is real and between 0.0F and 1.0F(if more usefull 't' values, calculate for each one the coresponding point,so to find wich is the closest) //use Durand-Kerner method Vector2 complex = new Vector2(0.4f, 0.9f); //randomly chosen value Vector2[] t = new Vector2[degree]; for (int j = 0; j < degree; ++j) { t[j] = pow(complex, j); } Vector2[] t_prev = new Vector2[degree]; const int MAX_ITERS = 15; int count = 0; bool condition; do { condition = false; for (int j = 0; j < degree; ++j) { t_prev[j] = t[j]; Vector2 denom = Vector2.right; for (int k = 0; k < degree; ++k) { if (j != k) { denom = ComplexMultiplier(denom, t[j] - t[k]); } } Vector2 revDenom = new Vector2(denom.x, -denom.y) / denom.sqrMagnitude; t[j] = t[j] - ComplexMultiplier(f(t[j], Q, max_degree - degree), revDenom); } count += 1; for (int j = 0; j < degree; ++j) { condition = condition || (Mathf.Abs(t[j].y - t_prev[j].y) >= error || Mathf.Abs(t[j].x - t_prev[j].x) >= error); } }while ((count < MAX_ITERS) && condition); float distance = -1.0F; for (int j = 0; j < degree; ++j) { if (Mathf.Abs(t[j].y) < error && t[j].x >= 0.0F && t[j].x <= 1.0F) { Vector2 samplePoint = Curves.SampleBezier((float)t[j].x, p1, c1, c2, p2); float dist = Vector2.SqrMagnitude(samplePoint - point); if (distance < 0.0F || dist < distance) { distance = dist; //get the closest point that is on the curve (if any ..) closestPoint = samplePoint; closestPointTValue = (float)t[j].x; } } } if (distance < 0) { return(Mathf.Infinity); } return(distance); }
private bool SetFacesAndOffset(bool testOnly, object distanceFromHere, object distanceToHere) { if (distanceFromHere == null || distanceToHere == null) { return(true); // because this means, you can use the object } List <Face> fromHere = new List <Face>(); List <Face> toHere = new List <Face>(); Vertex vtx1 = distanceFromHere as Vertex; Vertex vtx2 = distanceToHere as Vertex; Edge edg1 = distanceFromHere as Edge; Edge edg2 = distanceToHere as Edge; Face fc1 = distanceFromHere as Face; Face fc2 = distanceToHere as Face; ICurve crv1 = distanceFromHere as ICurve; ICurve crv2 = distanceToHere as ICurve; originalOffset = GeoVector.NullVector; if (distanceToHere is GeoObject.Point pnt && vtx2 == null) { vtx2 = new Vertex(pnt.Location); } if (vtx1 != null && vtx2 != null) { originalOffset = vtx1.Position - vtx2.Position; } else if ((vtx1 != null && edg2 != null) || (vtx2 != null && edg1 != null)) { Vertex vtx; Edge edg; List <Face> lv, le; if (vtx1 != null) { vtx = vtx1; edg = edg2; lv = fromHere; le = toHere; } else { vtx = vtx2; edg = edg1; lv = toHere; le = fromHere; } double cpos = edg.Curve3D.PositionOf(vtx.Position); originalOffset = vtx.Position - edg.Curve3D.PointAt(cpos); if (vtx1 == null) { originalOffset.Reverse(); } } else if ((vtx1 != null && fc2 != null) || (vtx2 != null && fc1 != null)) { Vertex vtx; Face fc; List <Face> lv, le; if (vtx1 != null) { vtx = vtx1; fc = fc2; lv = fromHere; le = toHere; } else { vtx = vtx2; fc = fc1; lv = toHere; le = fromHere; } GeoPoint2D[] pfs = fc.Surface.PerpendicularFoot(vtx.Position); for (int i = 0; i < pfs.Length; i++) { if (fc.Contains(ref pfs[i], true)) { originalOffset = vtx.Position - fc.Surface.PointAt(pfs[i]); if (vtx1 == null) { originalOffset.Reverse(); } break; } } } else if ((edg1 != null || crv1 != null) && (edg2 != null || crv2 != null)) { double pos1 = 0.5, pos2 = 0.5; if (crv1 == null) { crv1 = edg1.Curve3D; } if (crv2 == null) { crv2 = edg2.Curve3D; } if (crv1 is Line l1 && crv2 is Line l2) { if (Precision.SameDirection(l1.StartDirection, l2.StartDirection, false)) { double u = crv1.PositionOf(crv2.StartPoint); originalOffset = crv2.StartPoint - crv1.PointAt(u); offsetStartPoint = crv1.PointAt(u); } else { Geometry.DistLL(l1.StartPoint, l1.StartDirection, l2.StartPoint, l2.StartDirection, out double par1, out double par2); originalOffset = l2.PointAt(par2) - l1.PointAt(par1); offsetStartPoint = l1.PointAt(par1); } } else if (crv1.GetPlanarState() == PlanarState.Planar && crv2.GetPlanarState() == PlanarState.Planar) { // probably parallel planes, so newton could find anything GeoPoint foot = crv1.GetPlane().ToLocal(crv2.StartPoint); originalOffset = crv2.StartPoint - foot; offsetStartPoint = foot; } else if (Curves.NewtonMinDist(crv1, ref pos1, crv2, ref pos2)) { originalOffset = crv2.PointAt(pos2) - crv1.PointAt(pos1); offsetStartPoint = crv1.PointAt(pos1); } // else no distance between two curves, maybe check some more cases, which make a usable offset }
static void SerializeAndRetrieve() { ServerConnector.StartServer(); IMongoClient client = ClientConnector.GetClient(); IMongoDatabase db = client.GetDatabase("test"); Curves x = new Curves(); var coll = db.GetCollection<Curves>("curves"); //IMongoCollection<BsonDocument> collTEST = db.GetCollection<BsonDocument>("HAHAHA"); // @@@ is this create autmaticaly? //Console.WriteLine("collTEST worked! - so autocreated"); //coll.UpdateOne(k => k.Name = "me", x); look at ilters var uu = coll.Count(k => true); // @is mongo db returning pointers? var content = coll.Find(k => true); var t = coll.Find(k => k.Name == "me").SingleOrDefaultAsync().Result; // single expects only one element, or default will stop erros incase not found var all = coll.Find(k => true).ToList(); //@@@@ //async Task MainAsync() //{ // IMongoCollection<ApplicationUser> userCollection = ...; // var applicationUser = await userCollection.Find(_ => _.Id == inputId).SingleAsync(); //} Console.WriteLine(t.GetType().ToString()); Console.ReadLine(); }
private void setDuration(ZedGraphControl zed, DateTimeOffset since, DateTimeOffset until) { double min = zed.GraphPane.XAxis.Scale.Min = since.DateTime.ToOADate(); double max = zed.GraphPane.XAxis.Scale.Max = until.DateTime.ToOADate(); List <SeFlg> centricFlags = new List <SeFlg> { SeFlg.GEOCENTRIC, SeFlg.HELIOCENTRIC }; List <double> xValues = new List <double>(); for (double x = min; x <= max; x++) { xValues.Add(x); } for (int i = zed.GraphPane.CurveList.Count - 1; i >= 0; i--) { CurveItem curve = zed.GraphPane.CurveList[i]; removeCurve(zedLongTerm, curve); } foreach (SeFlg flag in centricFlags) { CentricFlag = flag; #region Get the longitude curves OrbitsDict = CurrentEphemeris.AllOrbitsCollectionDuring(since, until); TheAspectarian = CurrentEphemeris.AspectarianDuring(since, until, defaultAspectImportance); //populateAspectarian(TheAspectarian); //Special treatment of average longDif by replacing them with the smoothed version without gap generated when a planet enters Aries for (int i = CurrentEphemeris.Luminaries.IndexOf(PlanetId.Five_Average); i < CurrentEphemeris.Luminaries.Count; i++) { PlanetId id = CurrentEphemeris.Luminaries[i]; List <double> beforeShift = OrbitsDict[PositionValueIndex.Longitude][id]; List <double> afterShift = Ephemeris.SmoothingOfAverage(beforeShift); OrbitsDict[PositionValueIndex.Longitude].Remove(id); OrbitsDict[PositionValueIndex.Longitude].Add(id, afterShift); } #endregion Curves.Clear(); foreach (KeyValuePair <PlanetId, List <double> > kvp in OrbitsDict[PositionValueIndex.Longitude]) { String name = Planet.Glyphs[kvp.Key].ToString(); Color color = Planet.PlanetsColors.ContainsKey(kvp.Key) ? Planet.PlanetsColors[kvp.Key].First() : Color.Gray; LineItem line = null; List <IPlanetEvent> signChanges = CurrentEphemeris[since, until, PlanetEventFlag.SignChangedCategory, kvp.Key]; if (signChanges != null && signChanges.Count != 0) { List <double> finalYs = new List <double>(kvp.Value); List <double> finalXs = new List <double>(xValues); for (int i = signChanges.Count - 1; i >= 0; i--) { SignEntrance change = signChanges[i] as SignEntrance; double x = (change.When - since).TotalDays; double y = Math.Round(change.Where.Longitude); int insertPos = (int)x + 1; if (y != 0 && y != 360) { finalXs.Insert(insertPos, x + min); finalYs.Insert(insertPos, y); } else { finalXs.Insert(insertPos, x + min); finalXs.Insert(insertPos, x + min); finalYs.Insert(insertPos, change.IsRetrograde ? 360 : 0); finalYs.Insert(insertPos, change.IsRetrograde ? 0 : 360); } } line = new LineItem(name, finalXs.ToArray(), finalYs.ToArray(), color, SymbolType.None); } else { line = new LineItem(name, xValues.ToArray(), kvp.Value.ToArray(), color, SymbolType.None); } Curves.Add(kvp.Key, new Dictionary <int, CurveItem> { { 0, line } }); } getEventCurves(); } }
public IEnumerator <CurveBase> GetEnumerator() { return(Curves.GetEnumerator()); }
public void RemoveCurve(Curve curve) { Curves.Remove(curve); }
void Start() { animator = GetComponent<Animator>(); curves = GameObject.FindObjectOfType (typeof(Curves)) as Curves; //audioDing = GameObject.FindObjectOfType (typeof(AudioLoop)) as AudioLoop; buffCoolDown = new Timer(); catchTimer = new Timer(); blockTimer = new Timer(); fireTimer = new Timer(); stunTimer = new Timer(); waitAfterSoot = new Timer(); dashTimer = new Timer(); buffTimer = new Timer(); gameScript = GameObject.FindObjectOfType (typeof(Game)) as Game; masterScript = GameObject.FindObjectOfType(typeof(MasterScript)) as MasterScript; int c; if (this.tag == "Player1") { c = 1; } else { c = 2; } crystal = masterScript.GetCrystal(c); // animator = GetComponent<Animator>(); myTransform = this.GetComponent<Rigidbody2D>(); //var children = gameObject.GetComponentsInChildren<Transform>() as GameObject;// finde Trigger //foreach (var child in children) missTrigger.SetActive(false); blockTrigger.SetActive(false); //blockShild.SetActive(false); buffEffect.SetActive(false); wallTop = fieldHeight / 2; wallBottom = -fieldHeight / 2; wallRight = fieldWidth / 2; wallLeft = -fieldWidth / 2; dashCost = dashEnergyCost; if (InvertMotion) //Spieler Steht Links oder Recht Steuerung anpassen { motionInverter = -1; } else { motionInverter = 1; } animator.SetBool("Start", true); }
private void MarkSections(Simulator simulator, List <TrackVectorSection> SectionList, float Len) { if (null == simulator) { throw new ArgumentNullException(nameof(simulator)); } if (Len < simulator.Settings.SuperElevationMinLen || SectionList.Count == 0) { return;//too short a curve or the list is empty } TrackSections tSection = simulator.TSectionDat.TrackSections; TrackSection sectionData = tSection.Get(SectionList[0].SectionIndex); if (sectionData == null) { return; } //loop all section to determine the max elevation for the whole track double Curvature = sectionData.Angle * SectionList.Count * 33 / Len; //average radius in degree/100feet float Max = (float)(Math.Pow(simulator.Route.SpeedLimit * 2.25, 2) * 0.0007 * Math.Abs(Curvature) - 3); //in inch Max *= 2.5f; //change to cm Max = (float)Math.Round(Max * 2, MidpointRounding.AwayFromZero) / 200f; //closest to 5 mm increase; if (Max < 0.01f) { return; } if (Max > MaximumAllowedM) { Max = MaximumAllowedM; //max } Max = (float)Math.Atan(Max / 1.44f); //now change to rotation in radius by quick estimation as the angle is small Curves.Add(new List <TrackVectorSection>(SectionList)); //add the curve MapWFiles2Sections(SectionList); //map these sections to tiles, so we can compute it quicker later if (SectionList.Count == 1) //only one section in the curve { SectionList[0].StartElev = SectionList[0].EndElev = 0f; SectionList[0].MaxElev = Max; } else//more than one section in the curve { int count = 0; foreach (TrackVectorSection section in SectionList) { if (count == 0) { section.StartElev = 0f; section.MaxElev = Max; section.EndElev = Max; } else if (count == SectionList.Count - 1) { section.StartElev = Max; section.MaxElev = Max; section.EndElev = 0f; } else { section.StartElev = section.EndElev = section.MaxElev = Max; } count++; } } }
/// <summary> /// Renderes the path to the buffer /// and returns the normalized curve data /// the path should be a normalized set of points from 0 - 1 /// </summary> /// <param name="path"></param> /// <param name="buffer"></param> /// <returns></returns> protected List <MathHelpers.Point> RenderPath(List <CurvePoint> path, RawBitmap buffer, byte r = 175, byte g = 175, byte b = 175) { List <MathHelpers.Point> points = new List <MathHelpers.Point>(); List <MathHelpers.Point> curve = new List <MathHelpers.Point>(); List <MathHelpers.Point> normalized = new List <MathHelpers.Point>(); double width = CurveView.ActualWidth; double height = CurveView.ActualHeight - 1; foreach (CurvePoint p in path) { MathHelpers.Point n = p.Normalized; points.Add(new MathHelpers.Point(n.X * width, n.Y * height)); } Sort(points); //make sure we have x points on edges if (points.Count >= 2) { MathHelpers.Point f = points[0]; if (f.X > 0) { points.Insert(0, new MathHelpers.Point(0, f.Y)); } MathHelpers.Point l = points[points.Count - 1]; if (l.X < width) { points.Add(new MathHelpers.Point(width, l.Y)); } } double[] sd = Curves.SecondDerivative(points.ToArray()); for (int i = 0; i < points.Count - 1; ++i) { MathHelpers.Point cur = points[i]; MathHelpers.Point next = points[i + 1]; for (double x = cur.X; x < next.X; ++x) { double t = (double)(x - cur.X) / (next.X - cur.X); double a = 1 - t; double bt = t; double h = next.X - cur.X; double y = a * cur.Y + bt * next.Y + (h * h / 6) * ((a * a * a - a) * sd[i] + (bt * bt * bt - bt) * sd[i + 1]); if (y < 0) { y = 0; } if (y > height - 1) { y = height - 1; } curve.Add(new MathHelpers.Point(x, y)); normalized.Add(new MathHelpers.Point(x / width, y / height)); } } MathHelpers.Point lp = points[points.Count - 1]; curve.Add(lp); normalized.Add(new MathHelpers.Point(lp.X / width, lp.Y / height)); Parallel.For(0, curve.Count - 1, i => { MathHelpers.Point p1 = curve[i]; MathHelpers.Point p2 = curve[i + 1]; buffer.DrawLine((int)p1.X, (int)p1.Y, (int)p2.X, (int)p2.Y, r, g, b, 255); }); return(normalized); }
private bool showLine() { ArrayList usable1Curves = new ArrayList(); ArrayList usable2Curves = new ArrayList(); ArrayList usable3Curves = new ArrayList(); Plane pl; Plane pl1; double mindist = double.MaxValue; if (tang1Curves == null) { return(false); } if (tang2Curves == null) { return(false); } // if (tang3Curves == null) return false; for (int i = 0; i < tang1Curves.Length; ++i) { for (int j = 0; j < tang2Curves.Length; ++j) { if (Curves.GetCommonPlane(tang1Curves[i], tang2Curves[j], out pl)) { if (tang3Curves == null) { return(true); // bei zwei bestimmten: sind in der gleichen Ebene } for (int k = 0; k < tang3Curves.Length; ++k) { if (Curves.GetCommonPlane(tang1Curves[i], tang3Curves[k], out pl1)) { if (Precision.IsEqual(pl, pl1)) { ICurve2D l2D1 = tang1Curves[i].GetProjectedCurve(pl); if (l2D1 is Path2D) { (l2D1 as Path2D).Flatten(); } ICurve2D l2D2 = tang2Curves[j].GetProjectedCurve(pl); if (l2D2 is Path2D) { (l2D2 as Path2D).Flatten(); } ICurve2D l2D3 = tang3Curves[k].GetProjectedCurve(pl); if (l2D3 is Path2D) { (l2D3 as Path2D).Flatten(); } GeoPoint2D[] tangentPoints = Curves2D.TangentCircle(l2D1, l2D2, l2D3, pl.Project(object1Point), pl.Project(object2Point), pl.Project(object3Point)); if (tangentPoints.Length > 0) { // eine gültige Linie ist gefunden //if (curve1Input.Fixed & curve2Input.Fixed & (tangentPoints.Length > 4)) //{ // int debug = 0; //} usable1Curves.Add(tang1Curves[i]); // zur lokalen Liste zufügen usable2Curves.Add(tang2Curves[j]); // zur lokalen Liste zufügen usable3Curves.Add(tang3Curves[k]); // zur lokalen Liste zufügen for (int l = 0; l < tangentPoints.Length; l += 4) { double dist = Geometry.Dist(tangentPoints[l + 1], pl.Project(object1Point)) + Geometry.Dist(tangentPoints[l + 2], pl.Project(object2Point)) + Geometry.Dist(tangentPoints[l + 3], pl.Project(object3Point)); if (dist < mindist) { mindist = dist; selected1 = usable1Curves.Count - 1; // merken, welche Kurven die aktuell benutzten sind selected2 = usable2Curves.Count - 1; selected3 = usable3Curves.Count - 1; // selSol / 6 entspricht div 6, um einige Zeilen tiefer weitere 6 Möglichkeiten auswählen zu können // (/ 4) und (* 4), da pro Lösung vier Punkte geliefert werden int m = (l + 4 * (Math.Abs(selSol) % (tangentPoints.Length / 4))) % tangentPoints.Length; center = tangentPoints[m]; circRad = Geometry.Dist(tangentPoints[m + 1], center); } } } if (mindist < double.MaxValue) { // base.MultiSolution = true; base.MultiSolutionCount = tangentPoints.Length / 4; circ.SetCirclePlaneCenterRadius(pl, pl.ToGlobal(center), circRad); tang1Curves = (ICurve[])usable1Curves.ToArray(typeof(ICurve)); // überschreibt die eigentliche Liste und wird unten an den Sender zurückgeliefert tang2Curves = (ICurve[])usable2Curves.ToArray(typeof(ICurve)); // überschreibt die eigentliche Liste und wird unten an den Sender zurückgeliefert tang3Curves = (ICurve[])usable3Curves.ToArray(typeof(ICurve)); // überschreibt die eigentliche Liste und wird unten an den Sender zurückgeliefert base.ShowActiveObject = true; return(true); } } } } } } } base.ShowActiveObject = false; base.MultiSolutionCount = 0; // base.MultiSolution = false; return(false); }
public void Add(CurveBase curve) { Curves.Add(curve); }