/// <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 height segment is being dragged. /// </summary> /// <param name="sender">The sender.</param> /// <param name="eventArgs">The event args.</param> private void OnHeightDragOngoing(object sender, DragEventArgs eventArgs) { if (!(sender is LineHandle lineHandle)) { return; } var segment = lineHandle.Line; var centroid = DataFetcher.GetSectionAlignedCoordsys(this.Component).Origin; var halfHeight = Distance.PointToLine(centroid, new Line(segment)); this.topHeightHandle.Line = PlaceAtDistanceFromPoint(this.topHeightHandle.Line, centroid, halfHeight); this.bottomHeightHandle.Line = PlaceAtDistanceFromPoint(this.bottomHeightHandle.Line, centroid, halfHeight); this.Graphics.Clear(); this.DrawRectangle(DataFetcher.GetBaseWidth(this.Component), 2.0 * halfHeight); }