Dear All,

I have 2 points which creates a line. I want to get angle of line and then draw another line with +30 degree. I can do it but I always get 7-10 degree more than actual angle.

I get distance between 2 points using

I think I'm not convert degree to azimuth correctly. Any idea?

FYI: azimuth is degrees clockwise from north

Here is my working code with comment and Debug results. Red texts are debug results.

I have 2 points which creates a line. I want to get angle of line and then draw another line with +30 degree. I can do it but I always get 7-10 degree more than actual angle.

I get distance between 2 points using

**IMeasurementTool.ConstructByPoints**, then I get angle using**IConstructAngle.ConstructLine**. Here I have angle and distance between 2 points. Now, I'll give**ConstructByPointDistAngle**first point, distance and angle to get second point. Now I calculate angle between first point and result point of**ConstructByPointDistAngle**but I get angle with 8.266233055077116 degree difference.I think I'm not convert degree to azimuth correctly. Any idea?

FYI: azimuth is degrees clockwise from north

Here is my working code with comment and Debug results. Red texts are debug results.

PointClass p1 = new PointClass();

PointClass p2 = new PointClass();

// Add data to points for test

p1.PutCoords(34.481560, 41.515391);

p2.PutCoords(34.702832, 41.795668);

ILine lineForAngle = new Line();

IMeasurementTool measurementTool = new MeasurementToolClass();

measurementTool.ConstructByPoints(p1, p2);

// Here we calculate distance between two points: (p1, p2)

double distance = measurementTool.Distance;

GeometryEnvironment geoEnv = new GeometryEnvironment();

IConstructAngle angleCalculator = (IConstructAngle)geoEnv;

lineForAngle.PutCoords(p1, p2);

// Here we calculate angle of line between (p1, p2) and the positive x-axis

double angle = angleCalculator.ConstructLine(lineForAngle);

// Convert radian to degree

angle *= 180 / Math.PI; // = 51.709836807757121 Degree

// Convert angle to azimuth (still degree)

angle = 90 - angle; // = 38.290163192242879

// Here I give first point (p1), azimuth and distance to get p2

measurementTool.ConstructByPointDistAngle(p1, distance, angle);

geoEnv = new GeometryEnvironment();

angleCalculator = (IConstructAngle)geoEnv;

// I put p1 and result point of measurementTool which is a point

lineForAngle.PutCoords(p1, measurementTool.ToPoint);

// Now I have calculate angle between p1 and result of measurementTool

angle = angleCalculator.ConstructLine(lineForAngle);

angle *= 180 / Math.PI; // = 43.443603752680005

// first angle - result angle:

// 51.709836807757121 - 43.443603752680005 = 8.266233055077116

Hi!

To the point of your problem.

You use the intricate algorithm. I think it's easier to use IConstructPoint.ConstructDeflection method with the negative value of the angle (in radians) and the necessary distance.