2D Affine Transformation Calculator — Coordinate Mapping, Scale and Rotation Validator
Calculate transformed x and y coordinates with scale factor using two reference points, a local test point, rotation, and scaling constraints.
Enter the known values and review the calculated result
Input parameters
Use consistent values and select the intended engineering units.
Local coordinate system
Global coordinate system
Point to transform
Transformation settings
Results
Engineering Pro Save, document and continue this calculation
Turn this result into a reusable engineering record with saving, PDF export and reporting workflows.
Method, application and limitations
Review the calculation method, intended application and engineering assumptions before using the result in a design decision.
Formula and calculation method
transformed coordinate and scale factor formula:
ΔxL = x₂ − x₁
ΔyL = y₂ − y₁
ΔxG = x₂′ − x₁′
ΔyG = y₂′ − y₁′
dL = √(ΔxL² + ΔyL²)
dG = √(ΔxG² + ΔyG²)
s = dG / dL
θ = atan2(ΔyG, ΔxG) − atan2(ΔyL, ΔxL)
tx = x₁′ − s · (cos(θ) · x₁ − sin(θ) · y₁)
ty = y₁′ − s · (sin(θ) · x₁ + cos(θ) · y₁)
x′ = s · (cos(θ) · x − sin(θ) · y) + tx
y′ = s · (sin(θ) · x + cos(θ) · y) + ty
where:
- x₁, y₁ — first local reference point coordinates (length)
- x₂, y₂ — second local reference point coordinates (length)
- x₁′, y₁′ — first global reference point coordinates (length)
- x₂′, y₂′ — second global reference point coordinates (length)
- x, y — local test point coordinates (length)
- x′, y′ — transformed global test point coordinates (length)
- s — scale factor (–)
- θ — rotation angle (rad)
- tx, ty — translation components (length)
When to use this calculator
When to use this calculator:
- Map a point from a local 2D coordinate system into a global 2D coordinate system using two matching reference points.
- Calculate transformed coordinates when translation, rotation, and optional scaling are defined by point pairs.
- Check whether a no-rotation constraint is compatible with the supplied local and global reference points.
- Check whether a no-scaling constraint is compatible with the distance between reference points.
- Detect orientation reversal when optional third reference points are provided in both coordinate systems.
How to interpret the result
Transformed coordinates are defined as the local test point after applying the scale, rotation, and translation derived from the two reference-point pairs.
Scale factor is defined as the ratio between global reference-point distance and local reference-point distance. Increasing the global reference-point distance increases the scale factor. Increasing the local reference-point distance decreases the scale factor.
- Safe — the relative mapping error is ≤ 1e-6, the orthogonality error is ≤ 1e-6, and no orientation reversal is detected.
- Warning — the relative mapping error is > 1e-6 and ≤ 1e-3, or the orthogonality error is > 1e-6.
- Unsafe — the relative mapping error is > 1e-3, or orientation reversal is detected from the optional third reference points.
- Invalid — required coordinates are not valid numbers, coordinate magnitude exceeds 1e12, reference points are identical, scaling is disabled while scaling is required, rotation is disabled while rotation is required, or the transformation fails numerically.
The result is used to evaluate whether a local point can be mapped into the global coordinate system under the selected rotation and scaling constraints.
Calculation example
Example:
A user wants to transform a local inspection point into a global drawing coordinate system using two reference points.
- x₁ = 0 m, y₁ = 0 m
- x₂ = 2 m, y₂ = 0 m
- x₁′ = 10 m, y₁′ = 5 m
- x₂′ = 14 m, y₂′ = 5 m
- x = 1 m, y = 1 m
- Rotation constraint: allow rotation
- Scaling constraint: allow scaling
The transformed point is x′ = 12 m and y′ = 7 m, with scale factor s = 2.
Assumptions and limitations
- The transformation is defined from two matching reference points in the local and global coordinate systems.
- The scale factor is positive and calculated from the distance ratio between the global and local reference-point pairs.
- Rotation is calculated from the angular difference between the local and global reference-point directions.
- Translation is calculated so that the first local reference point maps onto the first global reference point.
- Orientation consistency is checked only when the optional third reference point is provided in both coordinate systems.
