## Sunday, November 02, 2014

### Alignment Curve Mid Point Coordinates

Remember primary school math? I sure don’t remember all of it. I find I’m relearning the remedial math over and over again since I forget the intricacies of what I learned before. One such concept is similar triangles. I learned it in Middle School math class and then once again during surveying class and once again programming numerous solutions. So sometimes I spend too much time solving other people’s problems. This blog post is one such instance.

The problem is adding Northing and Easting value of the mid point of an alignment curve. I usually break out the problem into parts. The first part is to determine how you want to solve the problem. I could have solved this problem by solving for the equation of line, or utilize the delta angles of a curve. I choose to utilize similar triangles. So first I have to figure out what similar triangle to use. In this case I know the center point location and the PI point, this has a length property that I can use. Here is the expression to get that value:

SQRT(({PI Easting}-{Center Easting})^2+({PI Northing}-{Center Northing})^2)

Next I need to know both the difference in northing and easting between those two values.

ABS({PI Easting}-{Center Easting})

ABS({PI Northing}-{Center Northing})

I need the difference as an absolute value because I need to some checks based on the delta angle later on. Next I need to get the distance of the leg of the triangle I’m solving for. In this case the Northing and Easting expressions are below.

Now I need to figure out how I should subtract or add the expressions above. One solution in this is if the delta angle is larger or smaller then pi (180%%d). The other solution is if center easting is larger or smaller then the PI easting. Once we determine this we can then apply the math correctly. Here is the expressions for the cases.

IF({Delta Angle}<pi,
IF({PI Easting}<{Center Easting},{Center Easting}-EastingDistance,{Center Easting}+EastingDistance),
IF({PI Easting}>{Center Easting},{Center Easting}-EastingDistance,{Center Easting}+EastingDistance))

IF({Delta Angle}<pi,
IF({PI Northing}<{Center Northing},{Center Northing}-NorthingDistance,{Center Northing}+NorthingDistance),
IF({PI Northing}>{Center Northing},{Center Northing}-NorthingDistance,{Center Northing}+NorthingDistance))

Now the ending expression can be used in an alignment label or curve table.

Here is a link to a drawing with the expressions. 