Skip navigation links

Package org.apache.commons.geometry.euclidean

This is the top-level package for Euclidean geometry components.

See: Description

Package org.apache.commons.geometry.euclidean Description

This is the top-level package for Euclidean geometry components.

Definition

Euclidean space is the space commonly thought of when people think of geometry. It corresponds with the common notion of "flat" space or the space that we usually experience in the physical world. Mathematically, Euclidean space is an affine space, meaning that it consists of points and displacement vectors representing translations between points. Distances between points are given by the formula \( \sqrt{(A - B)^2} \), which is also known as the Euclidean norm.

Points and Vectors

As alluded to above, points and vectors are separate, distinct entities: points represent locations in a space and vectors represent displacements. This difference is the reason that commons-geometry has separate Point and Vector interfaces. However, in the case of Euclidean space, the data structures used for points and vectors are identical and there is overlap in the methods needed for each type. Creating separate classes for Euclidean points and vectors therefore means a large amount of very similar or exactly duplicated code in order to maintain mathematical purity. This is not desirable, so a compromise position has been taken: there is a single class for each dimension that implements both Point and Vector. These classes are named Vector?D to reflect the fact that they support the full range of vector operations. It is up to users of the library to make the correct distinctions between instances that represent points and those that represent displacements. This approach is commonly used in other geometric libraries as well, such as the OpenGL Shading Language (GLSL), G3D, and Three.js.

Coordinate Systems

In general, geometric concepts are independent of the coordinate system used to represent them. For example, in 2-dimensional Euclidean space, the fact that two points may be subtracted to yield a displacement vector holds true regardless of whether the points are represented using Cartesian coordinates or polar coordinates. From this point of view, all coordinate systems can be considered equal. However, this library does not treat all systems equal. In order to keep the API lightweight and simple, all coordinates are assumed to be Cartesian unless explicitly noted otherwise.

See Also:
Euclidean Space
Skip navigation links

Copyright © 2016–2021 The Apache Software Foundation. All rights reserved.