Mathematics & Conversions

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.

Unit-aware inputs Deterministic calculation Engineering interpretation
Calculation workspace

Enter the known values and review the calculated result

Deterministic calculation
01
Parameters

Input parameters

Use consistent values and select the intended engineering units.

Local coordinate system

Global coordinate system

Point to transform

Transformation settings

02
Output

Results

Live
Ready to calculate Complete the required inputs and run the calculation.
Engineering Pro Save, document and continue this calculation

Turn this result into a reusable engineering record with saving, PDF export and reporting workflows.

Engineering reference

Method, application and limitations

Review the calculation method, intended application and engineering assumptions before using the result in a design decision.

01
Method

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)
02
Application

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.
03
Decision support

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.

04
Worked case

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.

05
Model boundaries

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.
06
Questions

Frequently asked questions

How to calculate transformed coordinates?
Transformed coordinates are calculated by applying scale, rotation, and translation to the local test point. The transformed x coordinate depends on the local x coordinate, local y coordinate, scale factor, rotation angle, and horizontal translation. The transformed y coordinate depends on the same local point, scale factor, rotation angle, and vertical translation.
How to calculate scale factor?
Scale factor is calculated as the global reference-point distance divided by the local reference-point distance. Increasing the global distance increases the scale factor. Increasing the local distance decreases the scale factor.
What affects transformed coordinates the most?
The result is affected by reference-point spacing, reference-point orientation, local test point position, and translation between coordinate systems. Changing the reference-point orientation changes the rotation angle. Changing the first global reference point changes the translation applied to the transformed point.
When is the transformed coordinate formula not valid?
The formula is not valid when required coordinates are empty, non-numeric, or larger than 1e12 in absolute value. It is also invalid when the two local reference points are identical, when the two global reference points are identical, when scaling is disabled but the reference-point distances require scaling, or when rotation is disabled but the reference-point directions require rotation.
Can this calculator detect orientation reversal?
It can detect orientation reversal only when the optional third local reference point and optional third global reference point are both provided. If the orientation sign changes between the local and global point sets, the result is classified as unsafe.
Add an engineering note