# Algebra

#### kiloeras

Hello I need to resolve this

baseRad = Math.PI * 2.21050703333333/ 180;
targetRad = Math.PI * targetX / 180;
theta = 41.42872355- targetY;
thetaRad = Math.PI * theta / 180;

0.99999999993643984=

What are the values of target x and target y??

#### skipjack

Forum Staff
There is only one equation linking the two variables targetRad and thetaRad. You would need another equation to allow you to find their possible values. It would also be helpful to know that their values lie between 0 and 2$\pi$.

#### kiloeras

There is only one equation linking the two variables targetRad and thetaRad. You would need another equation to allow you to find their possible values. It would also be helpful to know that their values lie between 0 and 2$\pi$.
I think I can pass the angle.

I will show to you the code.

The code is about drawing an arrow.
First I have 2 coordiates points.
Basex/Basey
Targetx/targety

I know both of those values so I calculate the angle , the distance and some other trigonometry values.

After that I calculate the 90% of the hypothenuse so I can draw an error of a nice size.

But that's what left to do.I have the new hyptothenuse in km distance but I have to parse it to coordinates point

C#:
   var angle = CoordinatesDistanceExtensions.CalculateAngle(posicionGisReversed[i].X, posicionGisReversed[i].Y, posicionGisReversed[i + 1].X, posicionGisReversed[i + 1].Y);

var rectangle = CoordinatesDistanceExtensions.CalculateRect(mapPointLeftCopy.X, mapPointLeftCopy.Y, mapPoint.X, mapPoint.Y, angle);

public static double CalculateAngle(double baseX, double baseY, double targetX, double targetY)
{
var hipotenus = CoordinatesDistanceExtensions.DistanceTo(baseX, baseY, targetX, targetY, UnitOfLength.Kilometers);
var catetA = CoordinatesDistanceExtensions.DistanceTo(targetX, baseY, targetX, targetY, UnitOfLength.Kilometers);
var catetAPow = Math.Pow(catetA, 2);
var hipotenusPow = Math.Pow(hipotenus, 2);
var catetB = Math.Sqrt(hipotenusPow - catetAPow);
var sin2 = Math.Sin((catetB / hipotenus));

return sin2;
}

public static double DistanceTo(double baseX, double baseY, double targetX, double targetY, UnitOfLength unitOfLength)
{

var baseRad = Math.PI * baseX / 180;
var targetRad = Math.PI * targetX / 180;
var theta = baseY - targetY;
var thetaRad = Math.PI * theta / 180;
double dist =
dist = Math.Acos(dist);
dist = dist * 180 / Math.PI;
dist = dist * 60 * 1.1515;

return unitOfLength.ConvertFromMiles(dist);

}

public static RectanglePoint CalculateRect(double baseX, double baseY, double targetX, double targetY,double angle)
{
var hipotenus = CoordinatesDistanceExtensions.DistanceTo(baseX, baseY, targetX, targetY, UnitOfLength.Kilometers);
var catetA = CoordinatesDistanceExtensions.DistanceTo(targetX, baseY, targetX, targetY, UnitOfLength.Kilometers);
var catetAPow = Math.Pow(catetA, 2);
var hipotenusPow = Math.Pow(hipotenus, 2);

var catetB = Math.Sqrt(hipotenusPow - catetAPow);
var asin1 = Math.Asin(angle);

var hipotenus90 = hipotenus-((hipotenus * 90) / 100);

var CatetOposat90 = arcsin * hipotenus90;

var catet90Pow=Math.Pow(CatetOposat90, 2);
var hipote90Pow=Math.Pow(hipotenus90, 2);

var catetAdjacent90 = Math.Sqrt((hipotenus90 - catet90Pow));

RectanglePoint rectangle = new RectanglePoint()
{
cop = CatetOposat90,
hip=hipotenus90
};

return rectangle;
}

This is what its left to develop!!!
I dont know a lot about trigonometry so I'm not sure what to do with the angle
public static MapPoint CalculateMapPoint(double distance, double baseX, double baseY,double angle)
{
var baseRad = Math.PI * baseX / 180;
//targetx unknown
//targety unknown

var targetRad = Math.PI * targetX / 180;
var theta = baseY - targetY;
var thetaRad = Math.PI * theta / 180;

distance =
distance = Math.Acos(distance);

distance = distance * 180 / Math.PI;
distance = distance * 60 * 1.1515;

new MapPoint(targetx, targety)
return null;

return null;
}

The value Rectangle.hipotenus would equal to the distance

Last edited:

#### Nidog

Kiloeras just a tip: when writing x and y you should capitalize the x and y that makes it easier to read

Similar Math Discussions Math Forum Date
General Math
Algebra
Algebra
Algebra