Interface AffineSpace<V>

All Known Subinterfaces:
EuclideanSpace<V>

public interface AffineSpace<V>
Represents an affine space.

An affine space is a geometric structure that generalizes properties of Euclidean spaces in which parallel lines remain parallel. It consists of points and vectors, where vectors can be added to points to get new points, and two points can be subtracted to get a vector.

Key properties: - Points can be translated by vectors - The difference of two points is a vector - Linear combinations (interpolation) are supported

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Summary

    Modifier and Type
    Method
    Description
    default V
    barycenter(V[] points, Real[] weights)
    Computes a weighted average (barycentric combination) of points.
    difference(V a, V b)
    Computes the vector from point a to point b.
    interpolate(V a, V b, Real t)
    Computes a linear combination (interpolation) between two points.
    translate(V point, V vector)
    Translates a point by a vector.
  • Method Details

    • translate

      V translate(V point, V vector)
      Translates a point by a vector.

      This is the fundamental operation: point + vector = point

      Parameters:
      point - the point to translate
      vector - the translation vector
      Returns:
      the translated point
    • difference

      V difference(V a, V b)
      Computes the vector from point a to point b.

      This is the inverse operation: point - point = vector

      Parameters:
      a - the starting point
      b - the ending point
      Returns:
      the vector from a to b
    • interpolate

      V interpolate(V a, V b, Real t)
      Computes a linear combination (interpolation) between two points.

      Returns: a + t*(b-a) - t=0 gives a - t=1 gives b - t=0.5 gives midpoint

      Parameters:
      a - the first point
      b - the second point
      t - the interpolation parameter
      Returns:
      the interpolated point
    • barycenter

      default V barycenter(V[] points, Real[] weights)
      Computes a weighted average (barycentric combination) of points.

      Returns: w₁*p₁ + w₂*p₂ + ... + wₙ*pₙ where Σwᵢ = 1

      Parameters:
      points - the points
      weights - the weights (must sum to 1)
      Returns:
      the barycentric combination