From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- Master/CGuCAD/projects/Markus/PolyNode.cs | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Master/CGuCAD/projects/Markus/PolyNode.cs (limited to 'Master/CGuCAD/projects/Markus/PolyNode.cs') diff --git a/Master/CGuCAD/projects/Markus/PolyNode.cs b/Master/CGuCAD/projects/Markus/PolyNode.cs new file mode 100644 index 0000000..1eb5d56 --- /dev/null +++ b/Master/CGuCAD/projects/Markus/PolyNode.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections; +using Autodesk.AutoCAD.Geometry; +using System.IO; +using System.Globalization; + +namespace Praktikum +{ + class PolyNode + { + public int iNodeIndex; + public Point2d p2DPoint; + + public double GetWinkelPoint(PolyNode ZielPunkt) + { + return GetWinkelPoint(ZielPunkt.p2DPoint); + } + + public double GetWinkelPoint(Point2d ZielPunkt) + { + return CalcAngle(GetAnglePointToPoint(p2DPoint, ZielPunkt)); + } + + private double CalcAngle(double dRadiant) + { + double RotationsWinkelGrad = dRadiant * 180.0f / Math.PI; + + if (RotationsWinkelGrad < 0) + return 360 + RotationsWinkelGrad; + else + return RotationsWinkelGrad; + } + + private double GetAnglePointToPoint(Point2d PAusgangspunkt, Point2d PKreispunkt) + { + return (double)(Math.Atan2((double)(PKreispunkt.Y - PAusgangspunkt.Y), (double)(PKreispunkt.X - PAusgangspunkt.X))); + } + + public double Distance(Point2d p2dPunkt) + { + double xDist = (p2dPunkt.X - p2DPoint.X); + double yDist = (p2dPunkt.Y - p2DPoint.Y); + + return (Math.Sqrt(xDist * xDist + yDist * yDist)); + } + + public double Distance(PolyNode p2dPunkt) + { + return Distance(p2dPunkt.p2DPoint); + } + } +} + -- cgit v1.2.3