public void DrawGizmos(int frames) { int segCount = cps.Count - 3; if (segCount <= 0) { return; } Vector3 pre = Vector3.zero; int _detail = frames / segCount; bool first = true; for (int i = 0; i < segCount; i++) { if (i == segCount - 1) { _detail = _detail + (frames - _detail * segCount); } for (int j = 0; j < _detail; j++) { float t = (float)j / _detail; if (first) { pre = CurveUtil.Sample(cps[i].position, cps[i + 1].position, cps[i + 2].position, cps[i + 3].position, weight, t); first = false; } else { Vector3 now = CurveUtil.Sample(cps[i].position, cps[i + 1].position, cps[i + 2].position, cps[i + 3].position, weight, t); Gizmos.DrawLine(pre, now); pre = now; } } } }
public float GetMaxSpeed(int level) { return(baseSpeed * CurveUtil.MultiplierSample( levelSpeedMuliplierCurve, (float)level / numberOfLevels, maxSpeedMultiplier)); }
public void DrawLine() { LineRenderer tmpRen = GameManager.One.lineRen; int segCount = cps.Count - 3; if (segCount <= 0) { return; } Vector3 pre = Vector3.zero; int _detail = detail; tmpRen.positionCount = _detail * segCount + 1; for (int i = 0; i < segCount; i++) { for (int j = 0; j < _detail; j++) { float t = (float)j / _detail; Vector3 now = CurveUtil.Sample(cps[i].position, cps[i + 1].position, cps[i + 2].position, cps[i + 3].position, weight, t); tmpRen.SetPosition(i * _detail + j, now); } if (i == segCount - 1) { tmpRen.SetPosition(i * _detail + _detail, cps[i + 2].position); } } }
public Vector3 getTangentByDis() { if (indexNow < 0) { return(Vector3.forward); } return(CurveUtil.Tangent(cps[indexNow].position, cps[indexNow + 1].position, cps[indexNow + 2].position, cps[indexNow + 3].position, weight, tNow)); }
public Vector3 getSampleByDis() { if (indexNow < 0) { return(Vector3.zero); } return(CurveUtil.Sample(cps[indexNow].position, cps[indexNow + 1].position, cps[indexNow + 2].position, cps[indexNow + 3].position, weight, tNow)); }
public void UpdateArc() { if (!dirty) { return; } arcLength = CurveUtil.arcLength(cps, detail, weight); dirty = false; }
void Awake() { m_widget = GetComponent <UIWidget>(); if (m_AnimationCurve == null) { m_AnimationCurve = CurveUtil.CreateDialogIn(m_time); CurveUtil.scaleCurve(m_AnimationCurve, m_time); } }
void OnEnable() { levelDists[0] = 0; cumLevelDists[0] = 0; for (int i = 1; i < levelDists.Length; i++) { float d = GetMaxSpeed(i) * CurveUtil.NormalizedSample(levelLengthCurve, i, 1f, numberOfLevels, minLevelTime, maxLevelTime); levelDists[i] = d / gameProgressionMultiplier; cumLevelDists[i] = cumLevelDists[i - 1] + d; } curLevel = 0; }
protected override async void OnCreate() { config = await Addressables.LoadAssetAsync <DrillConfig>("configs/drill").Task; await LoadConfigs(config.workers); foreach (WorkerConfig workerConfig in config.workers) { await Register(workerConfig); } blockGroupSystem = World.GetOrCreateSystem <BlockGroupSystem>(); bounceCurve = CurveUtil.GetCurveBlobReference(config.drillBounceCurve.keys); moveCurve = CurveUtil.GetCurveBlobReference(config.drillMoveCurve.keys); }
public void UpdateFOVToPlayerSpeed() { float step = config.fovSpeed * Time.deltaTime; float targetFOV = CurveUtil.NormalizedSample( config.FOVCurve, player.GetVelocity(), 0.025f, difficulty.maxSpeedMultiplier * difficulty.baseSpeed, config.minFOV, config.maxFOV); target = new Vector2(targetFOV, 0); current = new Vector2(cam.fieldOfView, 0); result = Vector3.MoveTowards(current, target, step); cam.fieldOfView = result.x; }
public static int GetCost(string upgrade, int level, LevelDifficultyScriptableObject difficulty) { int cost = 0; switch (upgrade) { case "Racer": cost = 5000; break; case "SUV": cost = 5000; break; case "Acceleration": cost = (int)(10 * CurveUtil.MultiplierSample( difficulty.accelerationUpgradeMuliplierCurve, (float)level / numberOfLevels, maxAccelerationMultiplier)); break; case "Body": cost = (int)(11 * CurveUtil.MultiplierSample( difficulty.bodyUpgradeMuliplierCurve, (float)level / numberOfLevels, maxBodyMultiplier)); break; case "Efficiency": cost = (int)(12 * CurveUtil.MultiplierSample( difficulty.efficiencyUpgradeMuliplierCurve, (float)level / numberOfLevels, maxEfficiencyMultiplier)); break; default: break; } return(cost); }
private static void ModifyPointTangentMode(ref Keyframe key, int leftRight) { if (leftRight == 0) { CurveUtil.SetKeyTangentMode(ref key, 0, CurveUtil.TangentMode.Editable); if (!CurveUtil.GetKeyBroken(key)) { key.outTangent = key.inTangent; CurveUtil.SetKeyTangentMode(ref key, 1, CurveUtil.TangentMode.Editable); } } else { CurveUtil.SetKeyTangentMode(ref key, 1, CurveUtil.TangentMode.Editable); if (!CurveUtil.GetKeyBroken(key)) { key.inTangent = key.outTangent; CurveUtil.SetKeyTangentMode(ref key, 0, CurveUtil.TangentMode.Editable); } } }
public Vector3 getSampleByT(float t) { if (cps.Count < 4) { return(Vector3.zero); } int index = (int)t; float segt = t - index; if (index < 0) { return(cps[0].position); } else if (index >= cps.Count - 3) { return(cps[cps.Count - 1].position); } else { return(CurveUtil.Sample(cps[index].position, cps[index + 1].position, cps[index + 2].position, cps[index + 3].position, weight, segt)); } }
protected override void OnUpdate() { if (groupSystem.IsReady == false) { return; } var map = groupSystem.BlocksMap; EntityCommandBuffer buffer = commandBufferSystem.CreateCommandBuffer(); ComponentDataFromEntity <Depth> depthLookup = GetComponentDataFromEntity <Depth>(); float time = (float)Time.ElapsedTime; float deltaTime = Time.DeltaTime; var size = groupSystem.GroupSize; NativeHashMap <int2, int> checkMap = new NativeHashMap <int2, int>(groupSystem.GroupSize.x * groupSystem.GroupSize.y, Allocator.TempJob); NativeList <int2> pointBuffer = new NativeList <int2>(groupSystem.GroupSize.x * groupSystem.GroupSize.y, Allocator.TempJob); var rand = Random.CreateFromIndex((uint)Time.ElapsedTime);; var isDrilledLookup = GetComponentDataFromEntity <IsBeingDrilled>(); var markLookup = GetComponentDataFromEntity <Mark>(); float3 origin = groupSystem.VisualOrigin; float scaleMultiplierThreshold = 0.25f; Dependency = Entities.WithReadOnly(depthLookup) .ForEach((Entity entity, ref Worker worker, ref Translation translation, ref NonUniformScale scale, ref DestinationPoint destination, ref VerticalLimit verticalLimit, ref DrillPower power, in WorkerAnimations animations) => { float drillTime = worker.Timer; bool isBouncing = power.Bounces < worker.MaxBounces; if (isBouncing == false && worker.Timer >= 1) { power.Bounces = 0; } float y = verticalLimit.Value + CurveUtil.Evaluate(ref animations.Bounce.Value.Keyframes, drillTime) * verticalLimit.FlightHeight * scale.Value.x; if (isBouncing == false) { var t = CurveUtil.Evaluate(ref animations.Move.Value.Keyframes, drillTime); float3 newPos = origin + math.lerp( new float3(destination.PreviousPoint.x, y, destination.PreviousPoint.y), new float3(destination.Value.x, y, destination.Value.y), t); translation.Value = newPos; } else { translation.Value = new float3(translation.Value.x, y, translation.Value.z); } if (worker.Timer >= 1 && isBouncing) { worker.Timer = 0; float newScale = scale.Value.x - worker.SizeLossPerHit; scale.Value = new float3(newScale, newScale, newScale); Depth depth = depthLookup[worker.CurrentBlock]; var centerMarkAmount = power.Amount * math.max(scale.Value.x, 0.1f); int2 center = destination.Value; verticalLimit.Value = -(depth.Value + centerMarkAmount); LeaveMark(size, center, buffer, centerMarkAmount, map, depthLookup, worker); if (worker.Radius > 0) { float factor = 0.8f; LeaveMark(size, new int2(center.x + 1, center.y), buffer, power.Amount * factor, map, depthLookup, worker); LeaveMark(size, new int2(center.x - 1, center.y), buffer, power.Amount * factor, map, depthLookup, worker); LeaveMark(size, new int2(center.x, center.y + 1), buffer, power.Amount * factor, map, depthLookup, worker); LeaveMark(size, new int2(center.x, center.y - 1), buffer, power.Amount * factor, map, depthLookup, worker); } if (worker.Radius > 1) { float factor = 0.6f; LeaveMark(size, new int2(center.x + 1, center.y - 1), buffer, power.Amount * factor, map, depthLookup, worker); LeaveMark(size, new int2(center.x - 1, center.y - 1), buffer, power.Amount * factor, map, depthLookup, worker); LeaveMark(size, new int2(center.x + 1, center.y + 1), buffer, power.Amount * factor, map, depthLookup, worker); LeaveMark(size, new int2(center.x - 1, center.y + 1), buffer, power.Amount * factor, map, depthLookup, worker); } if (worker.Radius > 2) { float spread = 0.4f; LeaveMark(size, new int2(center.x + 2, center.y), buffer, power.Amount * spread, map, depthLookup, worker); LeaveMark(size, new int2(center.x, center.y - 2), buffer, power.Amount * spread, map, depthLookup, worker); LeaveMark(size, new int2(center.x - 2, center.y), buffer, power.Amount * spread, map, depthLookup, worker); LeaveMark(size, new int2(center.x, center.y + 2), buffer, power.Amount * spread, map, depthLookup, worker); } if (worker.Radius > 3) { float spread = 0.2f; LeaveMark(size, new int2(center.x - 1, center.y + 2), buffer, power.Amount * spread, map, depthLookup, worker); LeaveMark(size, new int2(center.x - 2, center.y + 1), buffer, power.Amount * spread, map, depthLookup, worker); LeaveMark(size, new int2(center.x - 2, center.y - 1), buffer, power.Amount * spread, map, depthLookup, worker); LeaveMark(size, new int2(center.x - 1, center.y - 2), buffer, power.Amount * spread, map, depthLookup, worker); LeaveMark(size, new int2(center.x + 1, center.y - 2), buffer, power.Amount * spread, map, depthLookup, worker); LeaveMark(size, new int2(center.x + 2, center.y - 1), buffer, power.Amount * spread, map, depthLookup, worker); LeaveMark(size, new int2(center.x + 2, center.y + 1), buffer, power.Amount * spread, map, depthLookup, worker); LeaveMark(size, new int2(center.x + 1, center.y + 2), buffer, power.Amount * spread, map, depthLookup, worker); } if (worker.Radius > 4) { float spread = 0.1f; LeaveMark(size, new int2(center.x - 3, center.y), buffer, power.Amount * spread, map, depthLookup, worker); LeaveMark(size, new int2(center.x + 3, center.y), buffer, power.Amount * spread, map, depthLookup, worker); LeaveMark(size, new int2(center.x, center.y - 3), buffer, power.Amount * spread, map, depthLookup, worker); LeaveMark(size, new int2(center.x, center.y + 3), buffer, power.Amount * spread, map, depthLookup, worker); } power.Bounces++; if (power.Bounces >= worker.MaxBounces) { if (BlockUtil.GetClosestBlockOnSameLevel(rand, destination.Value, depthLookup, isDrilledLookup, map, checkMap, pointBuffer, size, out int2 next)) { buffer.RemoveComponent <IsBeingDrilled>(worker.CurrentBlock); destination.PreviousPoint = destination.Value; destination.Value = next; worker.CurrentBlock = map[next]; } } if (newScale <= 0.1f) { buffer.DestroyEntity(entity); buffer.RemoveComponent <IsBeingDrilled>(worker.CurrentBlock); } } float scaleMultiplier = math.max(scale.Value.x, scaleMultiplierThreshold); worker.Timer += deltaTime / worker.Frequency / scaleMultiplier; worker.Timer = math.min(1, worker.Timer); }).Schedule(Dependency); Dependency.Complete(); pointBuffer.Dispose(Dependency); checkMap.Dispose(Dependency); commandBufferSystem.AddJobHandleForProducer(Dependency); CurrentJob = Dependency; }
protected override void SolveInstance(IGH_DataAccess DA) { Mesh M = DA.Fetch <Mesh>("Mesh"); GH_Structure <GH_Curve> Curves = DA.FetchTree <GH_Curve>("Panels"); DataTree <Polyline> C = new DataTree <Polyline>(); GH_Structure <GH_Vector> edgeVectors = DA.FetchTree <GH_Vector>("EdgeVectors"); DataTree <Vector3d> EVec = new DataTree <Vector3d>(); int D = DA.Fetch <int>("JointDiv"); double L = DA.Fetch <double>("JointLen"); double H = DA.Fetch <double>("JointHei"); double W = DA.Fetch <double>("JointThi"); bool Center = DA.Fetch <bool>("Center"); bool Finger = DA.Fetch <bool>("Finger"); double Custom = DA.Fetch <double>("Custom"); GH_Structure <GH_Curve> CurvesChamfer = DA.FetchTree <GH_Curve>("PanelsChamfer"); DataTree <Polyline> CChamfer = new DataTree <Polyline>(); for (int i = 0; i < Curves.Branches.Count; i++) { for (int j = 0; j < Curves.get_Branch(i).Count; j++) { Polyline polyline; Curves.get_DataItem(Curves.Paths[i], j).Value.TryGetPolyline(out polyline); C.Add(polyline, Curves.Paths[i]); } } if (CurvesChamfer.DataCount == Curves.DataCount) { for (int i = 0; i < Curves.Branches.Count; i++) { for (int j = 0; j < Curves.get_Branch(i).Count; j++) { Polyline polyline; CurvesChamfer.get_DataItem(Curves.Paths[i], j).Value.TryGetPolyline(out polyline); CChamfer.Add(polyline, Curves.Paths[i]); } } } for (int i = 0; i < edgeVectors.Branches.Count; i++) { for (int j = 0; j < edgeVectors.get_Branch(i).Count; j++) { EVec.Add(edgeVectors.get_DataItem(edgeVectors.Paths[i], j).Value, edgeVectors.Paths[i]); } } //Solution DataTree <Polyline> diagonalConnections = new DataTree <Polyline>(); int divisions = Math.Max(1, D); double length = L;//Math.Max(0.1, L); double height = Math.Max(0.1, H); double width = Math.Max(0.1, W); int[][] tv = M.GetNGonsTopoBoundaries(); int[][] fe = M.GetNGonFacesEdges(tv); HashSet <int> e = M.GetAllNGonEdges(tv); Dictionary <int, int[]> efDict = M.GetFE(e, false); Point3d[] centers = M.GetNGonCenters(); DataTree <Polyline> Ccut = new DataTree <Polyline>(); for (int i = 0; i < C.BranchCount; i++) { for (int j = 0; j < C.Branch(i).Count; j++) { if (CurvesChamfer.DataCount == Curves.DataCount) { Ccut.Add(new Polyline(CChamfer.Branch(i)[j]), new GH_Path(CChamfer.Path(i))); } else { Ccut.Add(new Polyline(C.Branch(i)[j]), new GH_Path(C.Path(i))); //Rhino.RhinoApp.WriteLine(CChamfer.DataCount.ToString() + " " + Curves.DataCount.ToString()); } } } DataTree <Vector3d> EV = new DataTree <Vector3d>(); if (EVec.DataCount == 0) { foreach (int ee in e) { if (M.TopologyEdges.GetConnectedFaces(ee).Length != 1) { if (Center) { int[] facePair = efDict[ee]; Vector3d insertionVec = centers[facePair[0]] - centers[facePair[1]]; insertionVec.Unitize(); EV.Add(insertionVec, new GH_Path(ee)); //Line li = new Line(centers[facePair[0]] , centers[facePair[1]]); //Rhino.RhinoDoc.ActiveDoc.Objects.AddLine(li); } else { EV.Add(NGonsCore.VectorUtil.BisectorVector(M.TopologyEdges.EdgeLine(ee), M.GetNGonNormal(efDict[ee][0])), new GH_Path(ee)); } } } } else { EV = EVec; } DataTree <Polyline> recJoints = new DataTree <Polyline>(); for (int i = 0; i < EV.BranchCount; i++) { GH_Path p = EV.Path(i); int ecur = p.Indices[0]; int f0 = efDict[ecur][0]; int f1 = efDict[ecur][1]; //Divide line into points Line line = M.TopologyEdges.EdgeLine(ecur); Point3d[] pts = NGonsCore.PointUtil.InterpolatePoints(line.From, line.To, divisions, false); Point3d[] pts0 = new Point3d[pts.Length]; Point3d[] pts1 = new Point3d[pts.Length]; //Get average normal between faces Vector3d edgeNormal = M.GetNGonNormal(f0) + M.GetNGonNormal(f1); edgeNormal.Unitize(); Vector3d cross = Vector3d.CrossProduct(edgeNormal, EV.Branch(p)[0]); cross.Unitize(); //Get line planes Plane[] edgePlanes = new Plane[pts.Length]; Plane edgePlane90 = new Plane(line.PointAt(0.5), cross, edgeNormal); for (int j = 0; j < pts.Length; j++) { Vector3d v = EV.Branch(p)[0]; v.Unitize(); edgePlanes[j] = new Plane(pts[j], v, edgeNormal); } Point3d[][] edgePoints = new Point3d[edgePlanes.Length][]; for (int j = 0; j < edgePlanes.Length; j++) //C.Branch(f0).Count { Polyline[] rectangleWithoutJoints = new Polyline[] { new Polyline(), new Polyline() }; List <Polyline>[] rectangleJoints = new List <Polyline>[] { new List <Polyline>(), new List <Polyline>() }; foreach (int fn in efDict[ecur]) { int e0 = Array.IndexOf(fe[fn], ecur); edgePoints[j] = new Point3d[C.Branch(fn).Count]; Polyline[] perpJoint = new Polyline[C.Branch(fn).Count]; Polyline recJoint0 = new Polyline(); Polyline recJoint1 = new Polyline(); for (int k = 0; k < C.Branch(fn).Count; k++) { if (k % 2 == 0 && k != 0) { //rectangleJoints[0].Add(recJoint0); //rectangleJoints[1].Add(recJoint1); recJoint0.Clear(); recJoint1.Clear(); } Line segment = C.Branch(fn)[k].SegmentAt(e0); Plane planeOff0 = edgePlanes[j].MovePlanebyAxis(W * 0.5); Plane planeOff1 = edgePlanes[j].MovePlanebyAxis(-W * 0.5); Plane planeFace = C.Branch(fn)[k].plane(); Plane plane3 = new Plane(planeFace.Origin, edgePlanes[j].Normal, planeFace.Normal); //Face0 edge points Point3d edgePoint0 = PlaneUtil.LinePlane(segment, planeOff0); Point3d edgePoint1 = PlaneUtil.LinePlane(segment, planeOff1); //Inner Points Vector3d v0 = PlaneUtil.PlanePlaneVec(planeFace, planeOff0); Vector3d v1 = PlaneUtil.PlanePlaneVec(planeFace, planeOff1); bool moveFlag = (segment.PointAt(0.5) + v0).DistanceTo(planeFace.Origin) < (segment.PointAt(0.5) - v0).DistanceTo(planeFace.Origin); bool flagMod = j % 2 == 0; bool flagFace = efDict[ecur][0] == fn; flagMod = false; //double scalarLength = (centers[fn] - edgePlanes[j].Origin).Length*(double)Math.Abs(length); if (L < 0) { length = (centers[fn] - edgePlanes[j].Origin).Length * (double)Math.Abs(L); } //length = (centers[fn] - edgePlanes[j].Origin).Length*1; Point3d innerPoint0 = (moveFlag) ? edgePoint0 + (v0 * length) : edgePoint0 - (v0 * length); Point3d innerPoint1 = (moveFlag) ? edgePoint1 + (v1 * length) : edgePoint1 - (v1 * length); if (Finger) { innerPoint0 = (!moveFlag && !Finger) ? edgePoint0 + (v0 * length) : edgePoint0 - (v0 * length); innerPoint1 = (!moveFlag && !Finger) ? edgePoint1 + (v1 * length) : edgePoint1 - (v1 * length); } //Point3d innerPoint0 = edgePoint0 +(v0 * L); //Point3d innerPoint1 = edgePoint1 +(v1 * L) ; Polyline polylinep0 = new Polyline(new Point3d[] { edgePoint0, innerPoint0, innerPoint1, edgePoint1 }); // Rhino.RhinoDoc.ActiveDoc.Objects.AddPolyline(polylinep0); Line guideLine0 = new Line(edgePoint0, innerPoint0); Line guideLine1 = new Line(edgePoint1, innerPoint1); Point3d mid = (innerPoint1 + innerPoint0) * 0.5; innerPoint0 = guideLine0.ClosestPoint(mid, false); innerPoint1 = guideLine1.ClosestPoint(mid, false); Point3d center = (edgePoint0 + innerPoint0 + innerPoint1 + edgePoint1) * 0.25; Point3d center0 = guideLine0.ClosestPoint(center, false); Point3d center1 = guideLine1.ClosestPoint(center, false); perpJoint[k] = new Polyline(new Point3d[] { innerPoint0, center0, center1, innerPoint1 }); Polyline polyline0 = new Polyline(new Point3d[] { edgePoint0, center0, center1, edgePoint1 }); //finger joints or standard if (Finger) { if (efDict[ecur][0] == fn) { Ccut.Branch(efDict[ecur][0])[k].InsertPolyline(polyline0);//offset needed } else { Ccut.Branch(efDict[ecur][1])[k].InsertPolyline(polyline0);//offset needed } } else { Ccut.Branch(fn)[k].InsertPolyline(polyline0);//offset needed } if (fn == efDict[ecur][0]) { if (k == 1 || k == NGonsCore.MathUtil.Wrap(C.Branch(fn).Count - 2, C.Branch(fn).Count)) { rectangleWithoutJoints[0].Add(innerPoint0); rectangleWithoutJoints[1].Add(innerPoint1); } } else { if (k == 1) { rectangleWithoutJoints[0].Add(innerPoint0); rectangleWithoutJoints[1].Add(innerPoint1); } if (k == NGonsCore.MathUtil.Wrap(C.Branch(fn).Count - 2, C.Branch(fn).Count)) { rectangleWithoutJoints[0].Insert(2, innerPoint0); rectangleWithoutJoints[1].Insert(2, innerPoint1); } } // Rhino.RhinoDoc.ActiveDoc.Objects.AddPoint(innerPoint0); //Rhino.RhinoDoc.ActiveDoc.Objects.AddPoint(center0); //Rhino.RhinoDoc.ActiveDoc.Objects.AddPoint(innerPoint1); // Rhino.RhinoDoc.ActiveDoc.Objects.AddPolyline(recJoint0); //Rhino.RhinoDoc.ActiveDoc.Objects.AddPolyline(recJoint1); if (k % 2 == 0) { recJoint0.Add(innerPoint0); recJoint0.Add(center0); recJoint1.Add(innerPoint1); recJoint1.Add(center1); } else { recJoint0.Add(center0); recJoint0.Add(innerPoint0); recJoint1.Add(center1); recJoint1.Add(innerPoint1); } if (k % 2 == 1) { rectangleJoints[0].Add(new Polyline(recJoint0)); rectangleJoints[1].Add(new Polyline(recJoint1)); } if (k % 2 == 1) { //Rhino.RhinoDoc.ActiveDoc.Objects.AddPolyline(recJoint0); //Rhino.RhinoDoc.ActiveDoc.Objects.AddPolyline(recJoint1); } //edgePoints[j][k] = edgePoint0; // Rhino.RhinoDoc.ActiveDoc.Objects.AddPoint(edgePoint0); // Rhino.RhinoDoc.ActiveDoc.Objects.AddPoint(edgePoint1); // Rhino.RhinoDoc.ActiveDoc.Objects.AddPoint(innerPoint0); // Rhino.RhinoDoc.ActiveDoc.Objects.AddPoint(innerPoint1); // Rhino.RhinoDoc.ActiveDoc.Objects.AddPolyline(polyline0); } } for (int m = 0; m < rectangleWithoutJoints.Length; m++) { Line l0 = CurveUtil.ExtendLine(rectangleWithoutJoints[m].SegmentAt(0), height); Line l1 = CurveUtil.ExtendLine(rectangleWithoutJoints[m].SegmentAt(2), height); if (l0.From.DistanceTo(l1.From) < l0.From.DistanceTo(l1.To)) { l1.Flip(); } rectangleWithoutJoints[m] = new Polyline(new Point3d[] { l0.From, l0.To, l1.From, l1.To, l0.From }); // Line line } for (int m = 0; m < rectangleJoints[0].Count; m++) { //Rhino.RhinoDoc.ActiveDoc.Objects.AddPolyline(rectangleJoints[0][j]); rectangleWithoutJoints[0].InsertPolyline(rectangleJoints[0][m]); rectangleWithoutJoints[1].InsertPolyline(rectangleJoints[1][m]); } //try make special joint if (Custom >= 0 && C.Branch(0).Count == 4) { Polyline rebuild0 = new Polyline(); Polyline rebuild1 = new Polyline(); for (int m = 2; m < 18; m++) { if (m == 2) { Vector3d v0 = rectangleWithoutJoints[0][m] - rectangleWithoutJoints[0][m + 1]; v0.Unitize(); rebuild0.Add(rectangleWithoutJoints[0][m] + v0 * Custom); rebuild1.Add(rectangleWithoutJoints[1][m] + v0 * Custom); } else if (m == 17) { Vector3d v0 = rectangleWithoutJoints[0][17] - rectangleWithoutJoints[0][16]; v0.Unitize(); rebuild0.Add(rectangleWithoutJoints[0][17] + v0 * Custom); rebuild1.Add(rectangleWithoutJoints[1][17] + v0 * Custom); } else { rebuild0.Add(rectangleWithoutJoints[0][m]); rebuild1.Add(rectangleWithoutJoints[1][m]); } } rebuild0.Close(); rebuild1.Close(); rectangleWithoutJoints[0] = rebuild0; rectangleWithoutJoints[1] = rebuild1; } recJoints.AddRange(rectangleWithoutJoints, new GH_Path(ecur)); } //Rhino.RhinoDoc.ActiveDoc.Objects.AddPolyline(rectangleWithoutJoints[0]); //Rhino.RhinoDoc.ActiveDoc.Objects.AddPolyline(rectangleWithoutJoints[1]); //A = edgePlanes; } DA.SetDataTree(0, Ccut); DA.SetDataTree(1, recJoints); //DC = diagonalConnections; //Panels = Ccut; //Joints = recJoints; }