Initializing 3D Canvas...

The Point

1 min read•1 page

Point3d(X, Y, Z):

A zero-dimensional primitive representing an exact coordinate location in 3D Euclidean space.

A point is the fundamental building block of all geometry. It has no physical dimensions (no length, width, or depth); instead, it is purely a coordinate location in space.

python
1class Point3d:
2 def __init__(self, x: float = 0.0, y: float = 0.0, z: float = 0.0):
3 self.X = float(x)
4 self.Y = float(y)
5 self.Z = float(z)
6
7pt = Point3d(-2.0, 1.5, 0.0)
If you strip away the textures, the mesh faces, and the wireframe edges of any complex 3D model, you are left with a vast array of points in a coordinate system.
Point X
-2.00
Point Y
1.50
Point Z
0.00
2 min read•1 page

Coordinates (X, Y, Z):

Stores the position of a point as three double-precision floating-point values anchored to the Origin.

While a vector is a collection of numbers representing direction and magnitude [X, Y, Z] floating freely without a fixed location, a Point is strictly anchored to the Origin (0, 0, 0).

When you evaluate the coordinates (X, Y, Z), you are measuring the position vector required to travel from the Origin to that absolute location. At its core, a point is stored in memory as an ordered tuple of three 64-bit floats (X, Y, Z).

python
1class Point3d:
2 def __init__(self, x: float, y: float, z: float):
3 self.X = float(x)
4 self.Y = float(y)
5 self.Z = float(z)
6
7 def __str__(self):
8 return f"Point3d({self.X}, {self.Y}, {self.Z})"
9
10 @classmethod
11 def Origin(cls):
12 """Gets the point at (0,0,0)."""
13 return cls(0.0, 0.0, 0.0)
Point3d vs. Vector3d: An algorithmic point is an abstract data type with the exact same 3-float memory layout as a vector, differentiated by how transformations (such as translation) affect it.
Coordinate X
-2.00
Coordinate Y
1.50
2 min read•1 page

Subtract(Point3d):

Subtracting start point A from target point B (B - A, or B.Subtract(A)) yields the Vector3d pointing from A to B. Remember: Target minus Start.
python
1class Point3d:
2 def Subtract(self, other: 'Point3d') -> 'Vector3d':
3 """B.Subtract(A) (or B - A) yields the Vector pointing from A to B."""
4 return Vector3d(
5 self.X - other.X,
6 self.Y - other.Y,
7 self.Z - other.Z
8 )
9
10# Target minus Start: B - A points from A to B
11vec_ab = point_b.Subtract(point_a)
This is the fundamental bridge between points and vectors. Brush up on the Vector article if needed.
Point B (X)
3.00
Point B (Y)
-1.60
1 min read•1 page

DistanceTo(Point3d):

Calculates the absolute Euclidean distance between two points using the 3D Pythagorean theorem.
python
1import math
2
3class Point3d:
4 def DistanceTo(self, other: 'Point3d') -> float:
5 """Returns the distance between two points."""
6 dx, dy, dz = other.X - self.X, other.Y - self.Y, other.Z - self.Z
7 return math.sqrt(dx**2 + dy**2 + dz**2)
Euclidean distance measures the straight-line length of the displacement vector between two points, forming the basis for proximity queries, collision checks, and radius-based falloffs.
X
3.00
Y
-4.00
Z
0.00
2 min read•1 page

DistanceToSquared(Point3d):

Calculates the square of the distance between two points. This is purely a performance optimization.
python
1import math
2
3class Point3d:
4 def DistanceTo(self, other: 'Point3d') -> float:
5 # EXPENSIVE: math.sqrt is a heavy operation
6 dx = self.X - other.X
7 dy = self.Y - other.Y
8 dz = self.Z - other.Z
9 return math.sqrt(dx**2 + dy**2 + dz**2)
10
11 def DistanceToSquared(self, other: 'Point3d') -> float:
12 # CHEAP: No square root required
13 dx = self.X - other.X
14 dy = self.Y - other.Y
15 dz = self.Z - other.Z
16 return dx**2 + dy**2 + dz**2

Square roots (math.sqrt) are computationally expensive. When writing algorithms likeClosestPoint that compare thousands of distances to find the smallest one, we don't need the actual distance, we just need to know which one is relatively smaller.


If A < B, then A² < B². Using DistanceToSquared inside loops saves significant processing time.

Move B (X)
3.00
2 min read•1 page

Interpolate(Point3d, float):

Linearly interpolates between two points. This is exactly how you find a point along a line segment at a specific parameter t.
python
1class Point3d:
2 def Interpolate(self, other: 'Point3d', t: float) -> 'Point3d':
3 """Finds a point between self and other based on parameter t."""
4 # t = 0.0 returns self
5 # t = 1.0 returns other
6 # t = 0.5 returns the midpoint
7
8 return Point3d(
9 self.X + (other.X - self.X) * t,
10 self.Y + (other.Y - self.Y) * t,
11 self.Z + (other.Z - self.Z) * t
12 )
Parameter (t)
0.50
2 min read•1 page

Centroid(list[Point3d]):

Calculates the average center (centroid) of a list of points.
python
1def Centroid(points: list[Point3d]) -> Point3d:
2 """Calculates the arithmetic average of a list of points."""
3 n = len(points)
4 if n == 0:
5 return None
6
7 cx = sum(p.X for p in points) / n
8 cy = sum(p.Y for p in points) / n
9 cz = sum(p.Z for p in points) / n
10
11 return Point3d(cx, cy, cz)
The centroid is the arithmetic mean position of all the points in the set. It represents the perfect geometric center of a point cloud.
P1 X Offset
-2.50
P2 Y Offset
3.00
2 min read•1 page

WeightedCenter(list[Point3d], list[float]):

Calculates a single center point from multiple points, influenced by the 'weight' of each point.
python
1def WeightedCenter(points: list[Point3d], weights: list[float]) -> Point3d:
2 """Calculates the center of mass based on point weights."""
3 total_weight = sum(weights)
4
5 if total_weight == 0:
6 return None
7
8 cx = sum(p.X * w for p, w in zip(points, weights)) / total_weight
9 cy = sum(p.Y * w for p, w in zip(points, weights)) / total_weight
10 cz = sum(p.Z * w for p, w in zip(points, weights)) / total_weight
11
12 return Point3d(cx, cy, cz)
Unlike a simple average (centroid), a weighted center pulls the result closer to points with higher weight values. This is essential for structural load distribution, centroid of non-uniform point clouds, and attractor systems.
Weight 1 (Top Left)
1.00
Weight 2 (Top Right)
1.00
Weight 3 (Bottom Left)
1.00
Weight 4 (Bottom Right)
1.00
Weight 5 (Center)
5.00
1 min read•1 page

Move(Vector3d):

Translation is the simple addition of a vector to a point's coordinates. It shifts the location of the point through space.
python
1class Point3d:
2 def Move(self, vector: 'Vector3d') -> 'Point3d':
3 """Translates the point by adding a vector."""
4 return Point3d(self.X + vector.X, self.Y + vector.Y, self.Z + vector.Z)
X
-3.00
Y
2.00
This is identical to vector Addition
1 min read•1 page

Scale(float):

Scaling a point does not make the point bigger. Instead, scaling changes the point's distance from a center of scaling (usually the Origin). Scaling by 2.0 doubles the length of the vector connecting the Origin to the Point.
python
1class Point3d:
2 def Scale(self, scale_factor: float) -> 'Point3d':
3 """Scales the point relative to the origin."""
4 return Point3d(self.X * scale_factor, self.Y * scale_factor, self.Z * scale_factor)
This is identical to vector Multiplication
Scale
2.00
3 min read•1 page

Rotate(Axis3d, float):

Rotating a point swings its coordinate vector in a circular arc around a specific center point and rotation axis.
python
1import math
2
3class Point3d:
4 def Rotate(self, axis: 'Vector3d', angle_degrees: float) -> 'Point3d':
5 """Rotates the point around the given unit axis."""
6 angle_rad = math.radians(angle_degrees)
7 cos_a = math.cos(angle_rad)
8 sin_a = math.sin(angle_rad)
9
10 ux, uy, uz = axis.X, axis.Y, axis.Z
11
12 # Rodrigues' rotation formula applied to the position vector
13 x_new = self.X * (cos_a + ux*ux*(1-cos_a)) + self.Y * (ux*uy*(1-cos_a) - uz*sin_a) + self.Z * (ux*uz*(1-cos_a) + uy*sin_a)
14 y_new = self.X * (uy*ux*(1-cos_a) + uz*sin_a) + self.Y * (cos_a + uy*uy*(1-cos_a)) + self.Z * (uy*uz*(1-cos_a) - ux*sin_a)
15 z_new = self.X * (uz*ux*(1-cos_a) - uy*sin_a) + self.Y * (uz*uy*(1-cos_a) + ux*sin_a) + self.Z * (cos_a + uz*uz*(1-cos_a))
16
17 return Point3d(x_new, y_new, z_new)
Positive angles follow the Right-Hand Rule: point your right thumb along the rotation axis, and your fingers curl in the direction of positive rotation.
Angle
90.00
1 min read•1 page

FindClosestPoint(Point3d, list[Point3d]):

Finding the closest point in a large collection is a fundamental search operation.
python
1def FindClosestPoint(test_pt: Point3d, cloud: list[Point3d]) -> Point3d:
2 """Brute force search for the closest point."""
3 closest = cloud[0]
4 min_dist = test_pt.DistanceTo(closest)
5
6 for pt in cloud:
7 d = test_pt.DistanceTo(pt)
8 if d < min_dist:
9 min_dist = d
10 closest = pt
11 return closest
While we can check every point (Brute Force), complex systems use Spatial Trees (like R-Trees or KD-Trees) to make this nearly instantaneous.
Test Point X
2.00
Test Point Y
2.00
2 min read•1 page

DistanceToPlane(Plane):

Calculates the signed distance from a point to a plane.
python
1def DistanceToPlane(point: Point3d, plane_origin: Point3d, plane_normal: Vector3d) -> float:
2 """Calculates the signed distance from a point to a plane."""
3 # Vector from plane origin to the test point
4 v = point - plane_origin
5
6 # Project the vector onto the plane normal
7 # Ensure normal is unitized
8 n = Vector3d(plane_normal)
9 n.Unitize()
10
11 # Signed distance is the dot product
12 return v * n
The signed distance is positive if the point lies in the direction of the plane normal, and negative if it lies on the opposite side.
Point Z Height
3.00
1 min read•1 page

ProjectTo(Plane):

Projects a 3D point orthogonally onto a mathematical plane.
python
1def ProjectToPlane(point: Point3d, plane_origin: Point3d, plane_normal: Vector3d) -> Point3d:
2 # Get signed distance to plane
3 d = DistanceToPlane(point, plane_origin, plane_normal)
4
5 # Shift point back along normal
6 return point - plane_normal * d
Unlike finding the closest point in a scattered cloud of points, this operation drops a point perfectly perpendicular onto a flat infinite surface. This is heavily used for flattening 3D models into 2D plans, shadow casting, and preparing geometry for laser cutting. It forms a bridge to The Plane article.
Point X
1.50
Point Y
-1.50
Point Z
3.00
Plane Tilt (deg)
15.00
1 min read•1 page

IsOnPlane(Plane):

Checks if a point lies on a plane within a given tolerance.
python
1def IsOnPlane(point: Point3d, plane_origin: Point3d, plane_normal: Vector3d, tolerance: float = 1e-6) -> bool:
2 """Checks if a point lies on a plane within a tolerance."""
3 dist = DistanceToPlane(point, plane_origin, plane_normal)
4 return abs(dist) <= tolerance
Because of floating-point inaccuracies, points are rarely exactly on a plane. We check if their perpendicular distance is less than or equal to a tiny tolerance.
Point Z Height
0.05
2 min read•1 page

Transform(Transform):

Applies a 4x4 Transformation Matrix to a point, modifying its position in space.
python
1class Point3d:
2 def Transform(self, m: list[list[float]]) -> 'Point3d':
3 """Applies a 4x4 homogeneous transformation matrix (w = 1.0)."""
4 x, y, z = self.X, self.Y, self.Z
5 new_x = m[0][0] * x + m[0][1] * y + m[0][2] * z + m[0][3] * 1.0
6 new_y = m[1][0] * x + m[1][1] * y + m[1][2] * z + m[1][3] * 1.0
7 new_z = m[2][0] * x + m[2][1] * y + m[2][2] * z + m[2][3] * 1.0
8 return Point3d(new_x, new_y, new_z)
While methods like Translate, Scale, and Rotate are convenient, under the hood they all generate a 4x4 Matrix and pass it to this master Transform method.
Matrix Tx
2.00
Matrix Ty
1.00
Matrix Tz
-1.00
This is the critical bridge to The Matrix article. By bundling complex sequences of moves, rotations, and scales into a single matrix, you can transform millions of points instantly on the GPU.
1 min read•1 page

Attractor:

A single point can act as an attractor or repeller in a generative system. By calculating the distance vector between the attractor point and a grid of other objects, we can scale or move the objects based on their proximity, producing organic, non-uniform distributions.
python
1# Attractor Logic
2for obj_pt in grid:
3 dist = attractor.DistanceTo(obj_pt)
4 if dist < threshold:
5 # Scale based on proximity
6 obj.Scale(1.0 / dist)
X
0.00
Y
0.00

Related Concepts