private bool IsSupportConeWithinXYAngleRange(SupportConeV2 supportCone1, SupportConeV2 supportCone2, float angleMin, float angleMax) { var xyAngleBetweenSupportCones = VectorHelper.CalcAngleBetweenVectorPoints(supportCone1.RefPointCSegment.Xy, this.RefPointCSegment.Xy, supportCone2.RefPointCSegment.Xy); Console.WriteLine(xyAngleBetweenSupportCones); if (xyAngleBetweenSupportCones < angleMin || xyAngleBetweenSupportCones > angleMax) { return(true); } else { return(false); } }
public void Update() { var supportCone = new SupportConeV2(this.TopHeight, this.TopRadius, this.MiddleRadius, this.BottomHeight, this.BottomRadius, 16, this.ModelIntersection, this.Color, this.Model, this._groundSupport, true, null, this.SupportConeType, this.BottomWidthCorrection, this.ASegmentRadius, this.ASegmentHeight, this.BSegmentRadius, this.BSegmentHeight, this.CSegmentRadius, this.DSegmentRadius, this.DSegmentHeight, true); this.ASegment = supportCone.ASegment; this.BSegment = supportCone.BSegment; this.CSegment = supportCone.CSegment; this.DSegment = supportCone.DSegment; this.TopSupportCone = supportCone.TopSupportCone; this.MiddleSupportCone = supportCone.MiddleSupportCone; this.BottomSupportCone = supportCone.BottomSupportCone; this.Triangles = supportCone.Triangles; }
private SupportConeV2 CreateSubSupportConeWithinRange(SupportConeV2 interlinkedSupportCone, SupportProfile supportProfile, int rotationAngle) { var rotationMatrix = Matrix4.CreateRotationZ(rotationAngle); var newSupportPointVector = interlinkedSupportCone.RefPointCSegment - this.RefPointCSegment; newSupportPointVector.Z = 0; newSupportPointVector.Normalize(); var rotatedVector = Vector3Class.Transform(newSupportPointVector, rotationMatrix); rotatedVector.Z = -1; rotatedVector.Normalize(); if (this.Model.SupportHelperStructure == null) { this.Model.SupportHelperStructure = new List <SupportCone>(); } var subSupportCone = new SupportConeV2(this.TopHeight, this.TopRadius, this.MiddleRadius, this.BottomHeight, this.BottomRadius, 26, new TriangleIntersection(new Triangle() { Normal = rotatedVector }, this.RefPointCSegment), Color.AntiqueWhite, aSegmentRadius: this.ASegmentRadius, aSegmentHeight: this.ASegmentHeight, bSegmentRadius: this.BSegmentRadius, bSegmentHeight: this.BSegmentHeight + (4 * this.MiddleRadius), cSegmentRadius: this.CSegmentRadius, dSegmentRadius: this.DSegmentRadius, dSegmentHeight: this.DSegmentHeight ); //add support interlinks this.UpdateInterlinkConnections(subSupportCone, supportProfile); if (this.Model.SupportHelperStructure == null) { this.Model.SupportHelperStructure = new List <SupportCone>(); } this.Model.SupportHelperStructure.Add(subSupportCone); this.UpdateBinding(); return(subSupportCone); // }
public void UpdateInterlinkConnections(SupportConeV2 targetSupportCone, SupportProfile supportProfile) { for (var intermittedHeight = this.BottomHeight + supportProfile.SupportIntermittedConnectionHeight; intermittedHeight < targetSupportCone.RefPointCSegment.Z; intermittedHeight += supportProfile.SupportIntermittedConnectionHeight) { var startPoint = new Vector3Class(this.RefPointCSegment.X, this.RefPointCSegment.Y, intermittedHeight); var endPoint = targetSupportCone.RefPointCSegment; var xyDistance = endPoint - startPoint; xyDistance.Z = 0; endPoint.Z = intermittedHeight + (supportProfile.SupportIntermittedConnectionHeight * xyDistance.Length); if (InterlinkConnections == null) { this.InterlinkConnections = new SortedDictionary <float, List <SupportConeV2InterlinkConnection> >(); } if (!this.InterlinkConnections.ContainsKey(intermittedHeight)) { this.InterlinkConnections.Add(intermittedHeight, new List <SupportConeV2InterlinkConnection>()); } this.InterlinkConnections[intermittedHeight].Add(new SupportConeV2InterlinkConnection(0.1f, startPoint, endPoint, Color.Yellow)); } }