The Central Idea
A geometric object can often be represented by coordinates, and a geometric relationship can often be tested by a short numerical procedure.
For example, two points in the plane may be stored as
\[ P=(x_1,y_1) \]and
\[ Q=(x_2,y_2). \]The displacement from \(P\) to \(Q\) is the vector
\[ \boxed{\overrightarrow{PQ}=(x_2-x_1,\;y_2-y_1)}. \]This single subtraction operation converts a geometric relation into data that can be used for distance, direction, projection, orientation, motion, collision checks, and many other algorithms.
What Makes a Geometric Procedure an Algorithm?
An algorithm is a finite, repeatable procedure for transforming inputs into outputs.
In computational geometry, the inputs may be:
- point coordinates;
- vectors;
- line or segment endpoints;
- polygons or meshes;
- distances, angles, or tolerances.
The output may be a number, a new geometric object, or a logical decision such as left of, inside, parallel, or overlapping.
Coordinates as Data
A point in two-dimensional Cartesian space is usually represented as an ordered pair
\[ P=(x,y). \]In three dimensions, the point is represented as
\[ P=(x,y,z). \]Computationally, these coordinates can be stored in an array, tuple, record, or object. The mathematical representation and the software representation serve the same purpose: they identify the components needed for later operations.
Points and Vectors Use Similar Data but Different Meanings
A point describes a location. A vector describes a displacement, direction, or change.
The point
\[ P=(3,5) \]identifies a location. The vector
\[ \mathbf{v}=(3,5) \]describes a movement of \(3\) units in the \(x\)-direction and \(5\) units in the \(y\)-direction.
Their numerical components may be identical, but their geometric roles are different.
Subtracting Points Produces a Vector
Let
\[ P=(2,3),\qquad Q=(8,7). \]The displacement from \(P\) to \(Q\) is
\[ Q-P=(8-2,\;7-3). \]Therefore,
\[ \boxed{\overrightarrow{PQ}=(6,4)}. \]Point subtraction is one of the most frequently used operations in computational geometry.
Adding a Vector to a Point Produces a New Point
Suppose
\[ P=(2,3) \]and
\[ \mathbf{v}=(6,4). \]Translating \(P\) by \(\mathbf{v}\) gives
\[ P+\mathbf{v}=(2+6,\;3+4). \]Thus,
\[ \boxed{P+\mathbf{v}=(8,7)}. \]This is the computational form of translation.
Vector Addition
If
\[ \mathbf{u}=(u_x,u_y) \]and
\[ \mathbf{v}=(v_x,v_y), \]then
\[ \boxed{\mathbf{u}+\mathbf{v}=(u_x+v_x,\;u_y+v_y)}. \]Vector addition combines displacements.
For example,
\[ (3,-1)+(5,4)=(8,3). \]Vector Subtraction
Vector subtraction is performed component by component:
\[ \boxed{\mathbf{u}-\mathbf{v}=(u_x-v_x,\;u_y-v_y)}. \]For example,
\[ (7,5)-(2,8)=(5,-3). \]Subtraction is especially useful when constructing relative directions between points.
Scalar Multiplication
Multiplying a vector by a scalar changes its magnitude and may reverse its direction.
If
\[ \mathbf{v}=(v_x,v_y), \]then
\[ \boxed{k\mathbf{v}=(kv_x,\;kv_y)}. \]For example,
\[ 3(2,-4)=(6,-12). \]When \(k=-1\), the vector reverses direction.
Vector Magnitude
The magnitude of
\[ \mathbf{v}=(v_x,v_y) \]is
\[ \boxed{\|\mathbf{v}\|=\sqrt{v_x^2+v_y^2}}. \]For
\[ \mathbf{v}=(3,4), \]we obtain
\[ \|\mathbf{v}\|=\sqrt{3^2+4^2}=5. \]Magnitude converts a vector displacement into a scalar length.
Distance between Two Points
The distance between two points is the magnitude of their displacement.
For
\[ P=(x_1,y_1),\qquad Q=(x_2,y_2), \]form
\[ Q-P=(x_2-x_1,\;y_2-y_1). \]Then
\[ \boxed{ d(P,Q)=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2} }. \]Squared Distance Is Often Enough
Many algorithms only need to compare distances rather than report the distance itself.
Since square roots preserve the order of nonnegative numbers,
\[ d_1and avoid computing the square root.
This is a common example of choosing an equivalent but computationally simpler test.
Midpoint Algorithm
The midpoint of
\[ P=(x_1,y_1) \]and
\[ Q=(x_2,y_2) \]is found by averaging corresponding coordinates:
\[ \boxed{ M= \left( \frac{x_1+x_2}{2}, \frac{y_1+y_2}{2} \right) }. \]This can also be written in vector form as
\[ M=P+\frac{1}{2}(Q-P). \]Linear Interpolation between Points
The midpoint formula is one case of a more general construction called linear interpolation.
A point moving from \(P\) to \(Q\) can be written
\[ \boxed{ R(t)=P+t(Q-P) }. \]When
\[ 0\le t\le1, \]the point lies on the segment from \(P\) to \(Q\).
- \(t=0\) gives \(P\);
- \(t=\frac12\) gives the midpoint;
- \(t=1\) gives \(Q\).
Example: Interpolating along a Segment
Let
\[ P=(2,1),\qquad Q=(10,5). \]Then
\[ Q-P=(8,4). \]At \(t=\frac14\),
\[ R\left(\frac14\right) = (2,1)+\frac14(8,4). \]Therefore,
\[ \boxed{ R\left(\frac14\right)=(4,2) }. \]Normalizing a Vector
A unit vector has magnitude \(1\).
For a nonzero vector \(\mathbf{v}\), its normalized form is
\[ \boxed{ \widehat{\mathbf{v}} = \frac{\mathbf{v}}{\|\mathbf{v}\|} }. \]For
\[ \mathbf{v}=(3,4), \]we have \(\|\mathbf{v}\|=5\), so
\[ \widehat{\mathbf{v}} = \left(\frac35,\frac45\right). \]Normalization separates direction from magnitude.
Zero Vectors Need Special Handling
The vector
\[ \mathbf{0}=(0,0) \]has magnitude \(0\).
Attempting to normalize it would require division by zero:
\[ \frac{\mathbf{0}}{\|\mathbf{0}\|} = \frac{\mathbf{0}}{0}. \]Therefore, a robust normalization algorithm must first test whether the magnitude is zero, or sufficiently close to zero in approximate arithmetic.
The Dot Product
For
\[ \mathbf{u}=(u_x,u_y) \]and
\[ \mathbf{v}=(v_x,v_y), \]the dot product is
\[ \boxed{ \mathbf{u}\cdot\mathbf{v} = u_xv_x+u_yv_y }. \]It is a scalar rather than a vector.
The Dot Product as an Angular Test
The dot product also satisfies
\[ \mathbf{u}\cdot\mathbf{v} = \|\mathbf{u}\| \|\mathbf{v}\| \cos\theta. \]Therefore, for nonzero vectors:
- if \(\mathbf{u}\cdot\mathbf{v}>0\), the angle is acute;
- if \(\mathbf{u}\cdot\mathbf{v}=0\), the vectors are perpendicular;
- if \(\mathbf{u}\cdot\mathbf{v}<0\), the angle is obtuse.
An algorithm can often determine a directional relationship without explicitly computing the angle.
Avoiding Unnecessary Angle Calculations
Suppose an algorithm only needs to know whether two directions are perpendicular.
It does not need to compute
\[ \theta=\arccos \left( \frac{\mathbf{u}\cdot\mathbf{v}} {\|\mathbf{u}\|\|\mathbf{v}\|} \right). \]It can test the simpler condition
\[ \boxed{ \mathbf{u}\cdot\mathbf{v}=0 }. \]Computational geometry frequently replaces an expensive geometric quantity with a simpler equivalent predicate.
Projection onto a Vector
The projection of \(\mathbf{u}\) onto a nonzero vector \(\mathbf{v}\) is
\[ \boxed{ \operatorname{proj}_{\mathbf{v}}\mathbf{u} = \frac{\mathbf{u}\cdot\mathbf{v}} {\mathbf{v}\cdot\mathbf{v}} \mathbf{v} }. \]This formula is computationally useful because
\[ \mathbf{v}\cdot\mathbf{v} = \|\mathbf{v}\|^2. \]Projection is used in closest-point calculations, collision response, decomposition of motion, and many geometric constructions.
Perpendicular Vectors in Two Dimensions
If
\[ \mathbf{v}=(a,b), \]then two perpendicular vectors are
\[ (-b,a) \]and
\[ (b,-a). \]For example, if
\[ \mathbf{v}=(3,5), \]then
\[ \mathbf{n}=(-5,3) \]is perpendicular because
\[ (3)(-5)+(5)(3)=0. \]The Two-Dimensional Cross-Product Scalar
In the plane, two vectors
\[ \mathbf{u}=(u_x,u_y), \qquad \mathbf{v}=(v_x,v_y) \]can be combined using the determinant-like quantity
\[ \boxed{ \operatorname{cross2D}(\mathbf{u},\mathbf{v}) = u_xv_y-u_yv_x }. \]Although the three-dimensional cross product produces a vector, this two-dimensional form produces a scalar. Its sign is extremely useful for orientation tests.
Orientation of Three Points
Let
\[ A=(x_A,y_A),\qquad B=(x_B,y_B),\qquad C=(x_C,y_C). \]Form the two vectors
\[ \overrightarrow{AB}=B-A \]and
\[ \overrightarrow{AC}=C-A. \]Then compute
\[ \boxed{ \operatorname{orient}(A,B,C) = (x_B-x_A)(y_C-y_A) - (y_B-y_A)(x_C-x_A) }. \]Reading the Orientation Test
Under the usual Cartesian orientation:
- a positive result means \(A,B,C\) make a counterclockwise turn;
- a negative result means they make a clockwise turn;
- zero means the three points are collinear.
This one test is a foundational geometric predicate used in convex hulls, polygon algorithms, triangulation, segment tests, and many other computational procedures.
Example: Orientation
Let
\[ A=(1,1),\qquad B=(5,1),\qquad C=(3,4). \]Then
\[ B-A=(4,0) \]and
\[ C-A=(2,3). \]Therefore,
\[ \operatorname{orient}(A,B,C) = 4(3)-0(2)=12. \]Since \(12>0\), the turn from \(A\) to \(B\) to \(C\) is counterclockwise.
Signed Area of a Triangle
The same determinant used for orientation also measures twice the signed area of triangle \(ABC\):
\[ 2A_{\text{signed}} = \operatorname{orient}(A,B,C). \]Therefore, the ordinary area is
\[ \boxed{ A= \frac12 \left| \operatorname{orient}(A,B,C) \right| }. \]One computation can therefore answer two different geometric questions: orientation and area.
Collinearity as a Determinant Test
Three points are collinear exactly when
\[ \boxed{ \operatorname{orient}(A,B,C)=0 }. \]This is often more useful computationally than comparing slopes, because slope calculations can require division and become problematic for vertical lines.
Why Determinants Often Beat Slopes
The slope between two points is
\[ m= \frac{y_2-y_1}{x_2-x_1}. \]If \(x_2=x_1\), this expression requires division by zero.
By contrast, the orientation determinant uses only multiplication, subtraction, and addition. It handles vertical, horizontal, and oblique configurations in one uniform procedure.
Axis-Aligned Bounding Boxes
A simple way to enclose a collection of planar points is with an axis-aligned bounding box, often abbreviated AABB.
For points
\[ P_i=(x_i,y_i), \]compute
\[ x_{\min}=\min_i x_i, \qquad x_{\max}=\max_i x_i, \] \[ y_{\min}=\min_i y_i, \qquad y_{\max}=\max_i y_i. \]These four values define the smallest axis-aligned rectangle containing all the points.
Point-in-Bounding-Box Test
A point
\[ P=(x,y) \]lies inside or on the boundary of an axis-aligned box when
\[ \boxed{ x_{\min}\le x\le x_{\max} } \]and
\[ \boxed{ y_{\min}\le y\le y_{\max} }. \]Bounding-box tests are inexpensive and are often used to reject impossible cases before more detailed geometry is computed.
Componentwise Minimum and Maximum
Given two points
\[ P=(x_1,y_1), \qquad Q=(x_2,y_2), \]their componentwise minimum is
\[ \min(P,Q)= \left( \min(x_1,x_2), \min(y_1,y_2) \right), \]while their componentwise maximum is
\[ \max(P,Q)= \left( \max(x_1,x_2), \max(y_1,y_2) \right). \]These operations are useful when building bounding regions from endpoints or expanding a box as new points are processed.
Coordinate Clamping
To clamp a scalar \(x\) to an interval \([a,b]\), define
\[ \boxed{ \operatorname{clamp}(x,a,b) = \min\bigl(\max(x,a),b\bigr) }. \]If \(xb\), the result is \(b\). Otherwise, the result is \(x\).
Clamping is a small but useful algorithmic tool in geometry, graphics, and nearest-point calculations.
Coordinate Transformations as Algorithms
A two-dimensional affine transformation can be written
\[ \boxed{ P'=AP+\mathbf{t} } \]where \(A\) is a \(2\times2\) matrix and \(\mathbf{t}\) is a translation vector.
If
\[ A= \begin{bmatrix} a & b\\ c & d \end{bmatrix}, \qquad P= \begin{bmatrix} x\\ y \end{bmatrix}, \]then
\[ P'= \begin{bmatrix} ax+by\\ cx+dy \end{bmatrix} + \begin{bmatrix} t_x\\ t_y \end{bmatrix}. \]Translation Algorithm
Translation by
\[ \mathbf{t}=(t_x,t_y) \]sends
\[ (x,y) \]to
\[ \boxed{ (x+t_x,\;y+t_y) }. \]To translate an entire polygon or mesh, apply the same operation to every vertex.
Scaling Algorithm
Scaling about the origin by factors \(s_x\) and \(s_y\) sends
\[ (x,y) \]to
\[ \boxed{ (s_xx,\;s_yy) }. \]Uniform scaling uses the same factor in both directions:
\[ s_x=s_y=s. \]Nonuniform scaling allows the two factors to differ.
Rotation Algorithm
Rotating a point about the origin through angle \(\theta\) gives
\[ \boxed{ \begin{aligned} x'&=x\cos\theta-y\sin\theta,\\ y'&=x\sin\theta+y\cos\theta. \end{aligned} } \]This is equivalent to multiplying by the rotation matrix
\[ \begin{bmatrix} \cos\theta & -\sin\theta\\ \sin\theta & \cos\theta \end{bmatrix}. \]Transforming about a Chosen Center
To rotate or scale about a point \(C\) rather than the origin:
- translate so that \(C\) moves to the origin;
- apply the desired rotation or scaling;
- translate back.
In vector notation,
\[ \boxed{ P'=C+A(P-C) }. \]This pattern appears repeatedly in graphics, CAD, and geometric modeling.
Three-Dimensional Vectors
The same componentwise ideas extend naturally to
\[ \mathbf{v}=(v_x,v_y,v_z). \]Its magnitude is
\[ \boxed{ \|\mathbf{v}\| = \sqrt{v_x^2+v_y^2+v_z^2} }. \]The dot product becomes
\[ \boxed{ \mathbf{u}\cdot\mathbf{v} = u_xv_x+u_yv_y+u_zv_z }. \]The Three-Dimensional Cross Product
For
\[ \mathbf{u}=(u_x,u_y,u_z) \]and
\[ \mathbf{v}=(v_x,v_y,v_z), \]the cross product is
\[ \boxed{ \mathbf{u}\times\mathbf{v} = \left( u_yv_z-u_zv_y,\; u_zv_x-u_xv_z,\; u_xv_y-u_yv_x \right) }. \]The result is perpendicular to both input vectors.
Surface Normals from Cross Products
Given three noncollinear points \(A\), \(B\), and \(C\) in three-dimensional space, form
\[ \mathbf{u}=B-A \]and
\[ \mathbf{v}=C-A. \]Then
\[ \boxed{ \mathbf{n}=\mathbf{u}\times\mathbf{v} } \]is normal to the plane of the triangle.
Normal vectors are fundamental in rendering, lighting, surface orientation, and mesh processing.
Degenerate Geometric Cases
A geometric configuration is often called degenerate when it collapses into a lower-dimensional or otherwise exceptional case.
Examples include:
- a segment whose endpoints are identical;
- three points that are collinear instead of forming a triangle;
- a vector with zero magnitude;
- a triangle with zero area;
- two nominally distinct coordinates that are numerically indistinguishable.
Robust algorithms check for these cases rather than assuming that every input is generic.
Exact Arithmetic and Approximate Arithmetic
Mathematical formulas are often written as though arithmetic were exact. Computers, however, commonly represent real-number approximations using floating-point numbers.
As a result, a theoretically exact equality such as
\[ a=b \]may appear computationally as two values that differ by a tiny amount.
This distinction matters when algorithms test collinearity, perpendicularity, coincidence, or other boundary conditions.
Using a Tolerance
Instead of testing whether an approximate quantity \(r\) equals zero exactly, an algorithm may test
\[ \boxed{ |r|\le\varepsilon } \]for a suitably chosen tolerance \(\varepsilon>0\).
For example, an approximate perpendicularity test might examine whether
\[ |\mathbf{u}\cdot\mathbf{v}| \le\varepsilon. \]The appropriate tolerance depends on the scale and numerical requirements of the problem. There is no universal tolerance that is correct for every computation.
Scale Matters in Numerical Tests
A fixed tolerance such as
\[ \varepsilon=10^{-9} \]may be reasonable for one coordinate scale and inappropriate for another.
Coordinates measured near \(1\) behave differently from coordinates near \(10^{12}\). For this reason, robust computational systems often use scale-aware comparisons, higher-precision arithmetic, or exact geometric predicates when correctness near boundaries is critical.
Geometric Predicates and Geometric Constructions
Computational geometry often separates operations into two broad types.
A predicate answers a question:
- Are these points collinear?
- Is this turn clockwise or counterclockwise?
- Is this point inside a bounding box?
A construction creates a new geometric object:
- construct a midpoint;
- construct a translated point;
- construct a projection;
- construct a normal vector.
Many larger algorithms alternate between predicates and constructions.
A Small Geometry Toolkit
A reusable coordinate-and-vector toolkit commonly includes procedures for:
- adding, subtracting, and scaling vectors;
- computing magnitudes and squared magnitudes;
- computing distances and squared distances;
- normalizing nonzero vectors;
- computing dot products;
- computing two-dimensional orientation values;
- computing three-dimensional cross products;
- interpolating between points;
- forming and testing bounding boxes;
- applying affine transformations.
More advanced computational geometry can then be built from these small, tested pieces.
Example: A Combined Coordinate Workflow
Let
\[ A=(1,2),\qquad B=(7,5). \]First compute the displacement:
\[ \mathbf{d}=B-A=(6,3). \]Its squared length is
\[ \|\mathbf{d}\|^2=6^2+3^2=45. \]Its length is
\[ \|\mathbf{d}\|=\sqrt{45}=3\sqrt5. \]The midpoint is
\[ M=A+\frac12\mathbf{d} =(1,2)+(3,\tfrac32). \]Therefore,
\[ \boxed{ M=\left(4,\frac72\right) }. \]Several geometric quantities were produced from one basic displacement vector.
Example: Classifying a Turn
Suppose a path passes through
\[ A=(0,0),\qquad B=(4,1),\qquad C=(5,5). \]Form
\[ B-A=(4,1) \]and
\[ C-A=(5,5). \]The orientation value is
\[ 4(5)-1(5)=15. \]Since the value is positive,
\[ \boxed{\text{the turn is counterclockwise}.} \]Example: Testing Perpendicularity
Let
\[ \mathbf{u}=(4,2) \]and
\[ \mathbf{v}=(-1,2). \]Their dot product is
\[ \mathbf{u}\cdot\mathbf{v} = 4(-1)+2(2)=0. \]Therefore,
\[ \boxed{ \mathbf{u}\perp\mathbf{v} }. \]Common Error: Confusing a Point with a Vector
The notation
\[ (3,4) \]does not by itself explain whether the object is a location or a displacement.
Algorithms become clearer when the roles are explicit:
\[ P=(3,4) \]for a point, and
\[ \mathbf{v}=(3,4) \]for a vector.
Common Error: Reversing a Displacement
The vector from \(P\) to \(Q\) is
\[ \boxed{Q-P}, \]not \(P-Q\).
Reversing the subtraction reverses the vector:
\[ P-Q=-(Q-P). \]The two vectors have the same magnitude but opposite directions.
Common Error: Normalizing the Zero Vector
The formula
\[ \widehat{\mathbf{v}} = \frac{\mathbf{v}}{\|\mathbf{v}\|} \]applies only when
\[ \|\mathbf{v}\|\ne0. \]A zero vector must be handled as a separate case.
Common Error: Computing an Angle When Only a Sign Is Needed
If the task is only to decide whether two vectors form an acute or obtuse angle, computing an inverse trigonometric function is unnecessary.
The sign of
\[ \mathbf{u}\cdot\mathbf{v} \]already answers the question.
Good algorithm design often means identifying the smallest computation that produces the required information.
Common Error: Comparing Slopes for Vertical Geometry
Slope comparisons can fail when a denominator becomes zero.
For collinearity and orientation, determinant-based formulas are usually more uniform:
\[ \operatorname{orient}(A,B,C) = (x_B-x_A)(y_C-y_A) - (y_B-y_A)(x_C-x_A). \]No division is required.
Common Error: Treating Floating-Point Equality as Exact Geometry
A computed value that should theoretically be zero may instead appear as
\[ 2.3\times10^{-15}. \]Whether that should be treated as zero depends on the numerical scale and requirements of the problem.
Robust computational geometry distinguishes mathematical equality from the practical comparison of approximate numerical values.
A Reliable Procedure for Coordinate Computation
- Identify which quantities are points and which are vectors.
- Write the needed coordinates explicitly.
- Construct displacement vectors by subtracting points in the correct order.
- Use componentwise arithmetic for vector operations.
- Avoid square roots or angle calculations when a simpler equivalent test is enough.
- Check for zero vectors and other degenerate inputs before division.
- Use determinant-based predicates for orientation and collinearity.
- Account for numerical tolerance when approximate arithmetic is involved.
- Verify the geometric meaning of the numerical output.
A Reliable Procedure for Building Geometric Algorithms
- Represent the geometric objects with coordinates or vectors.
- Reduce the geometric question to one or more basic predicates or constructions.
- Choose formulas that avoid unnecessary operations.
- Handle special and degenerate cases explicitly.
- Separate reusable operations into small functions or procedures.
- Test ordinary cases, boundary cases, and extreme coordinate scales.
- Confirm that the output matches the intended geometric interpretation.
Practice 1: Displacement Vector
Let
\[ P=(-2,3),\qquad Q=(5,11). \]Find \(\overrightarrow{PQ}\).
Practice 2: Squared Distance
Find the squared distance between
\[ A=(1,-2) \]and
\[ B=(7,6). \]Practice 3: Midpoint
Find the midpoint of
\[ P=(-4,5) \]and
\[ Q=(10,-1). \]Practice 4: Linear Interpolation
Let
\[ P=(2,2),\qquad Q=(14,8). \]Find the point
\[ R(t)=P+t(Q-P) \]when \(t=\frac13\).
Practice 5: Dot Product
Compute
\[ (3,-2)\cdot(4,5) \]and determine whether the angle between the vectors is acute, right, or obtuse.
Practice 6: Perpendicular Vector
Give one vector perpendicular to
\[ \mathbf{v}=(7,-3). \]Practice 7: Orientation
Determine whether the ordered points
\[ A=(0,0),\qquad B=(3,2),\qquad C=(4,6) \]make a clockwise turn, a counterclockwise turn, or are collinear.
Practice 8: Triangle Area
Find the area of the triangle with vertices
\[ A=(0,0),\qquad B=(6,0),\qquad C=(2,5). \]Practice 9: Bounding Box
Find the axis-aligned bounding box of the points
\[ (-2,4),\qquad(5,-1),\qquad(3,7),\qquad(0,2). \]Practice 10: Three-Dimensional Normal
Let
\[ A=(0,0,0),\qquad B=(1,0,0),\qquad C=(0,2,0). \]Compute
\[ (B-A)\times(C-A). \]Practice Answers
Practice 1
\[ \overrightarrow{PQ} = (5-(-2),\;11-3) = \boxed{(7,8)}. \]Practice 2
\[ d^2(A,B) = (7-1)^2+(6-(-2))^2 = 6^2+8^2 = \boxed{100}. \]Practice 3
\[ M= \left( \frac{-4+10}{2}, \frac{5+(-1)}{2} \right) = \boxed{(3,2)}. \]Practice 4
\[ Q-P=(12,6). \] \[ R\left(\frac13\right) = (2,2)+\frac13(12,6) = (2,2)+(4,2). \] \[ \boxed{ R\left(\frac13\right)=(6,4) }. \]Practice 5
\[ (3,-2)\cdot(4,5) = 12-10 = \boxed{2}. \]Because the dot product is positive, the angle is acute.
Practice 6
For \((a,b)=(7,-3)\), one perpendicular vector is
\[ (-b,a)=\boxed{(3,7)}. \]Check:
\[ (7,-3)\cdot(3,7)=21-21=0. \]Practice 7
\[ B-A=(3,2), \qquad C-A=(4,6). \] \[ \operatorname{orient}(A,B,C) = 3(6)-2(4) = 18-8 = 10. \]Since \(10>0\),
\[ \boxed{\text{the turn is counterclockwise}.} \]Practice 8
\[ \operatorname{orient}(A,B,C) = 6(5)-0(2) = 30. \] \[ A= \frac12|30| = \boxed{15}. \]Practice 9
The coordinate extremes are
\[ x_{\min}=-2,\qquad x_{\max}=5, \] \[ y_{\min}=-1,\qquad y_{\max}=7. \]Therefore, the bounding box is
\[ \boxed{ [-2,5]\times[-1,7] }. \]Practice 10
\[ B-A=(1,0,0), \qquad C-A=(0,2,0). \] \[ (1,0,0)\times(0,2,0) = \boxed{(0,0,2)}. \]What to Remember
Coordinate and vector algorithms convert geometric relationships into arithmetic operations.
- subtract points to form displacement vectors;
- use vector magnitude for length and distance;
- use squared distance when only comparison is needed;
- use the dot product for angular relationships and projection;
- use the two-dimensional cross-product scalar for orientation;
- use cross products in three dimensions to construct perpendicular directions;
- use interpolation to construct points along segments;
- use coordinate minima and maxima to construct bounding boxes;
- check zero, collinear, coincident, and other degenerate cases;
- treat floating-point comparisons carefully near geometric boundaries.
The larger lesson is that geometry does not need to be abandoned when a problem becomes computational. Instead, geometric structure is encoded in coordinates, vectors, determinants, and carefully chosen numerical tests.
Where We Go Next
Coordinate and vector algorithms provide the basic operations needed to represent directions, compare orientations, and construct points.
The next lesson, Line and Curve Intersection, uses these tools to determine where geometric paths meet, how to distinguish intersections from nonintersections, and how special cases such as parallelism, tangency, and overlapping geometry affect the computation.