<style> .reveal-up, .reveal-left, .reveal-right, .reveal-stagger > * { opacity: 1 !important; transform: none !important; } </style>
  1. Learn
  2. BIM Math
  3. Vectors
All lessons in this course

Lesson 6 of 44 12 minBeginner

Points vs vectors

A point is a position; a vector is a step with a direction and a length. Learn the four rules that connect them, and why keeping them apart prevents a whole class of bugs.

Both are written as a list of numbers, such as (6, 3), so it is easy to treat them as the same thing. They are not. A point is a position: the start of a wall, the centre of a column, the corner of a slab. A vector is a displacement: “6 m east and 3 m north”. It has a direction and a length, but no position. You can draw the same vector starting anywhere.

Drag A and B, then move both together with the buttons. The coordinates of the points change; the vector between them does not.

Interactive

Points move, vectors do not

Drag A and B (or focus one and use the arrow keys), then move both together with the buttons. Watch which numbers change.

originvvAB
Point A(2.0, 1.5)
Point B(8.0, 4.5)
v = B − A⟨6.0, 3.0⟩
A + v(8.0, 4.5) = B
Midpoint A + v ÷ 2(5.0, 3.0)
Length of v6.71 m

v from A to B   the same v from the origin

v = B − A = ⟨6.0, 3.0⟩. Point minus point gives a vector; point plus vector gives a point (A + v = B). The faint copy of v starts at the origin, and it is the same vector.

The four rules

ExpressionResultMeaning
point − pointvectorB − A is the step that takes you from A to B
point + vectorpointA + v is where you land after taking step v from A
vector ± vectorvectortwo steps combined, or one step undone
point + pointmeaningless“the wall start plus the column centre” is not a place

There is one useful exception to the last rule. A weighted average of points is fine as long as the weights add up to 1. The midpoint is ½A + ½B, which is really A + ½(B − A): a point plus a vector. The same idea gives any point along a wall: A + t(B − A), where t = 0 is A and t = 1 is B.

Points in a BIM model, and vectors

Points (positions)Vectors (directions and steps)
Wall start and end pointsA wall’s direction
A door’s insertion pointA door’s facing (which way it opens)
Column centres, slab cornersA face normal (which way a face points)
The survey point, the project base pointThe offset of a “Move” command
Grid intersectionsTrue north, the direction to the sun

The difference shows up as soon as you move something. Moving a building 10 m east changes every point in it, but a wall’s direction, a face’s normal and the direction to the sun stay exactly the same. A rotation, on the other hand, changes both. The Matrices module uses this: points and vectors are transformed by different rules, and mixing them up shifts normals off their faces.

Let the compiler keep them apart

Many APIs use one type for both (the Revit API’s XYZ, System.Numerics.Vector3), so nothing stops you from adding two points. If you write your own types, you can make the four rules the only operations that compile:

PointsAndVectors.cs
var a = new Pt(2, 1);var b = new Pt(8, 4); Vec v = b - a;                        // point - point = vectorConsole.WriteLine($"v = {v}"); var east = new Vec(10, 0);Pt a2 = a + east, b2 = b + east;      // point + vector = pointConsole.WriteLine($"Moved: {a2} to {b2}");Console.WriteLine($"v after the move = {b2 - a2}"); // Pt nonsense = a + b;               // does not compile: no Pt + Pt operator readonly record struct Pt(double X, double Y){    public static Vec operator -(Pt a, Pt b) => new(a.X - b.X, a.Y - b.Y);    public static Pt operator +(Pt p, Vec v) => new(p.X + v.X, p.Y + v.Y);    public override string ToString() => $"({X}, {Y})";} readonly record struct Vec(double X, double Y){    public override string ToString() => $"<{X}, {Y}>";}
Output
v = <6, 3>
Moved: (12, 1) to (18, 4)
v after the move = <6, 3>
Quick check

Which of these is a vector, not a point?

Quick check

You move a whole building 5 m east. What happens?

Practice

A beam runs from (1, 2) to (9, 6). Using Pt and Vec with a new Vec * double operator, print the positions of three hangers at ¼, ½ and ¾ of the way along it.

Show a hint

Each hanger is start + (end − start) × t, with t = 0.25, 0.5 and 0.75. Add operator *(Vec v, double k) to Vec.

Show the solution
Solution.cs
var start = new Pt(1, 2);var end = new Pt(9, 6);Vec span = end - start; for (int i = 1; i <= 3; i++)    Console.WriteLine($"Hanger {i}: {start + span * (i / 4.0)}"); readonly record struct Pt(double X, double Y){    public static Vec operator -(Pt a, Pt b) => new(a.X - b.X, a.Y - b.Y);    public static Pt operator +(Pt p, Vec v) => new(p.X + v.X, p.Y + v.Y);    public override string ToString() => $"({X}, {Y})";} readonly record struct Vec(double X, double Y){    public static Vec operator *(Vec v, double k) => new(v.X * k, v.Y * k);}
Output
Hanger 1: (3, 3)
Hanger 2: (5, 4)
Hanger 3: (7, 5)

Remember

  • A point is a position; a vector is a displacement with a direction and a length, but no position.
  • point − point = vector, point + vector = point, vector ± vector = vector; point + point is meaningless.
  • Weighted averages of points are fine when the weights add up to 1: A + t(B − A) is any point along AB.
  • Moving a model changes its points but not its directions and normals; rotating changes both.
  • Separate types, or at least clear names, keep the two from being mixed up.
0 of 44 lessons completed