Skip to content

Commit

Permalink
refactor: used static XAxis and extract method for RadiansToDegrees
Browse files Browse the repository at this point in the history
  • Loading branch information
psarras committed Dec 18, 2024
1 parent 6d60b0f commit dc64135
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion GsaGH/Parameters/0_Model/GsaGridLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public GsaGridLine(Arc arc, string label = "") {

public GsaGridLine(Line line, string label = "") {
bool IsCounterClockwise = Vector3d.CrossProduct(Vector3d.XAxis, line.UnitTangent).Z > 0;
double vectorAngle = Vector3d.VectorAngle(new Vector3d(1, 0, 0), line.UnitTangent) * 180 / Math.PI;
double radians = Vector3d.VectorAngle(Vector3d.XAxis, line.UnitTangent);
double vectorAngle = RadiansToDegrees(radians);
if (!IsCounterClockwise) {
vectorAngle = 360 - vectorAngle;
}
Expand All @@ -80,6 +81,11 @@ public GsaGridLine(Line line, string label = "") {
UpdatePreview();
}

private static double RadiansToDegrees(double radians)
{
return radians * 180 / Math.PI;
}

internal static Arc ToArc(GridLine gridLine) {
var center = new Point3d(gridLine.X, gridLine.Y, 0);
double angleRadians = (gridLine.Theta2 - gridLine.Theta1) * Math.PI / 180.0;
Expand Down

0 comments on commit dc64135

Please sign in to comment.