/// <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> /// Called when a width segment is being dragged. /// </summary> /// <param name="sender">The sender.</param> /// <param name="eventArgs">The event args.</param> private void OnWidthDragOngoing(object sender, DragEventArgs eventArgs) { if (!(sender is LineHandle lineHandle)) { return; } var segment = lineHandle.Line; var centroid = DataFetcher.GetSectionAlignedCoordsys(this.Component).Origin; var halfWidth = Distance.PointToLine(centroid, new Line(segment)); this.rightWidthHandle.Line = PlaceAtDistanceFromPoint(this.rightWidthHandle.Line, centroid, halfWidth); this.leftWidthHandle.Line = PlaceAtDistanceFromPoint(this.leftWidthHandle.Line, centroid, halfWidth); this.Graphics.Clear(); this.DrawRectangle(2.0 * halfWidth, DataFetcher.GetBaseHeight(this.Component)); }