Creating line of varying distance from origin point using Python in ArcGIS Desktop?

The endpoint is displaced from the origin by 800 meters, of course. The displacement in the direction of the x-coordinate is proportional to the sine of the angle (east of north) and the displacement in the direction of the y-coordinate is proportional to the cosine of the angle.

Thus, from sin(15 degrees) = sin(0.261799) = 0.258819 and cos(15 degrees) = 0.965926 we obtain

x-displacement = 800 sin(15 degrees) = 800 * 0.258819 = 207.055 

y-displacement = 800 cos(15 degrees) = 800* 0.965926 = 772.741.

Therefore the endpoint coordinates are (400460.99 + 207.055, 135836.76 + 772.741) = (400668.05, 136609.49).


Building on @whuber's answer, if you wanted to implement this in Python, you'd calculate the displacement as stated, then create an output as a collection of points like so:

import arcpy
from math import radians, sin, cos

origin_x, origin_y = (400460.99, 135836.7)
distance = 800
angle = 15 # in degrees

# calculate offsets with light trig
(disp_x, disp_y) = (distance * sin(radians(angle)),\
                    distance * cos(radians(angle)))
(end_x, end_y) = (origin_x + disp_x, origin_y + disp_y)

output = "offset-line.shp"
arcpy.CreateFeatureClass_management("c:\workspace", output, "Polyline")
cur = arcpy.InsertCursor(output)
lineArray = arcpy.Array()

# start point
start = arcpy.Point()
(start.ID, start.X, start.Y) = (1, origin_x, origin_y)
lineArray.add(start)

# end point
end = arcpy.Point()
(end.ID, end.X, end.Y) = (2, end_x, end_y)
lineArray.add(end)

# write our fancy feature to the shapefile
feat = cur.newRow()
feat.shape = lineArray
cur.insertRow(feat)

# yes, this shouldn't really be necessary...
lineArray.removeAll()
del cur