Library / Geometry, coordinates, surveying and trigonometry / GEO-30
Geometry, coordinates, surveying and trigonometry
Angle between two straight lines
The smaller angle between two lines from their direction vectors u and v, between 0° and 90°.
- Ref
- GEO-30
- Rev
- v1
- Field
- Geometry, coordinates, surveying and trigonometry
- Result
- α [°]
The angle between two lines with direction vectors u and v follows from their cross and dot products: tan α = |u × v| / |u · v|. The two-argument arctangent takes this correctly even when u · v is zero, which is a right angle, or when a line is vertical. The result is the smaller angle, between 0° and 90°, and is the same whichever way the vectors point.
The smaller angle between two lines from their direction vectors u and v, between 0° and 90°. The two-argument arctangent is used, so perpendicular and vertical lines work.
Calculator
- Dot product u · v0
- Cross product u × v5
- Angle in radians1.571 rad
What drives the result
Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.
- Lines along (1, 2) and (−2, 1) meet at 90°, a right angle, because the dot product is zero.
- The result is always between 0° and 90°, so 100° between directions is reported as 80°, the angle between the lines themselves.
Chart data as tables
Ranked variables
| Variable | Typical range | Lowest result | Highest result | Swing (°) | Local step | Change in result |
|---|---|---|---|---|---|---|
| ux Direction u, x | −5 to 5 | 0 | 90 | 90 | +0.2 | −4.4 ° |
| vy Direction v, y | −5 to 5 | 0 | 90 | 90 | +0.2 | −4.4 ° |
| uy Direction u, y | −5 to 5 | 7.125 | 90 | 82.87 | +0.2 | −2.12 ° |
| vx Direction v, x | −5 to 5 | 7.125 | 90 | 82.87 | +0.2 | −2.49 ° |
Sweep of Direction u, x
| Direction u, x | Angle between the lines (°) |
|---|---|
| −5 | 4.764 |
| −3.75 | 1.507 |
| −2.5 | 12.09 |
| −1.25 | 31.43 |
| 0 | 63.43 |
| 1.25 | 84.56 |
| 2.5 | 65.22 |
| 3.75 | 54.64 |
| 5 | 48.37 |
Sweep one variable
Variables and how each one contributes
Angle between the lines
What the equation gives you. Everything else feeds it.
Direction u, x
The x-component of the direction vector of the first line, a plain number. Turns the first line and so changes the angle. Raising it by 0.5 (to 1.5) moves the result by −11.4 %, from 90 to 79.7 °.
Direction u, y
The y-component of the direction vector of the first line, a plain number. Turns the first line and so changes the angle. Raising it by 0.5 (to 2.5) moves the result by −5.29 %, from 90 to 85.24 °.
Direction v, x
The x-component of the direction vector of the second line, a plain number. Turns the second line and so changes the angle. Raising it by 0.5 (to −1.5) moves the result by −7.92 %, from 90 to 82.87 °.
Direction v, y
The y-component of the direction vector of the second line, a plain number. Turns the second line and so changes the angle. Raising it by 0.5 (to 1.5) moves the result by −11.4 %, from 90 to 79.7 °.
Worked example with the values above
- Cross product: 1 × 1 − 2 × −2 = 5.
- Dot product: 1 × −2 + 2 × 1 = 0.
- α = atan2(|5|, |0|) = 90°.
Assumptions and limits
- Plane (two-dimensional) Cartesian coordinates in one consistent unit.
- The two points or the two direction vectors are not the same, and neither vector has zero length.
Common mistakes
- Using the angle of each line with the x-axis and forgetting to take the smaller angle.
- Using a gradient formula when one line is vertical.
- Taking the direction vectors from the wrong ends, which only changes signs and not the angle.
Statistics and uncertainty
These are exact algebraic results from the coordinates, so the uncertainty comes from the inputs. Near-parallel lines and nearly collinear points are the cases where small input errors give large changes in angles or areas.
Where it is used
- Clearances, offsets and angles between members in drawings, CAD and surveying.
- Areas of plots, plates and polygon pieces from corner coordinates.
Maths you need
- Gradient: rise over run of a line
- Vector: direction and length written as (x, y)
- Dot product: the sum of products of components