/// <summary> /// Gets the rectangle, with the first segment being the right segment of the base, and going into counter /// clockwise direction. /// </summary> /// <returns>The list of segments.</returns> private List <LineSegment> GetRectangle() { var coordSys = DataFetcher.GetSectionAlignedCoordsys(this.Component); var height = DataFetcher.GetBaseHeight(this.Component); var width = DataFetcher.GetBaseWidth(this.Component); var radius = DataFetcher.GetRadius(this.Component); var length = DataFetcher.GetSectionLength(this.Component); var geometry = new TransitionSectionGeometry(height, width, length, radius, coordSys.Origin, coordSys.AxisX.Cross(coordSys.AxisY)); return(geometry.RectangularSection.OfType <LineSegment>().ToList()); }
/// <summary> /// Gets the arc representing the circle at the top of the section. /// </summary> /// <returns>The arc.</returns> private Arc GetCircle() { var coordSys = DataFetcher.GetSectionAlignedCoordsys(this.Component); double sectionLength = DataFetcher.GetSectionLength(this.Component); var normal = coordSys.AxisX.Cross(coordSys.AxisY).GetNormal(); var centerPoint = coordSys.Origin + sectionLength * normal; double radius = DataFetcher.GetRadius(this.Component); return(new Arc(centerPoint, coordSys.AxisX, coordSys.AxisY, radius, 2 * Math.PI)); }
/// <summary> /// Draws the preview of the base of the transition section. /// </summary> /// <param name="width">Width of the base.</param> /// <param name="height">Height of the base.</param> private void DrawRectangle(double width, double height) { var coordSys = DataFetcher.GetSectionAlignedCoordsys(this.Component); var radius = DataFetcher.GetRadius(this.Component); var length = DataFetcher.GetSectionLength(this.Component); var geometry = new TransitionSectionGeometry(height, width, length, radius, coordSys.Origin, coordSys.AxisX.Cross(coordSys.AxisY)); var rectangle = geometry.RectangularSection; foreach (var curve in rectangle) { if (curve is LineSegment segment) { this.Graphics.DrawLine(segment.StartPoint, segment.EndPoint); } else if (curve is Arc arc) { this.Graphics.DrawArc(arc); } } }