
hu.kazocsaba.math.geometry.Segment Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geometry Show documentation
Show all versions of geometry Show documentation
Basic geometric primitives and operations.
The newest version!
package hu.kazocsaba.math.geometry;
import hu.kazocsaba.math.matrix.Vector;
import hu.kazocsaba.math.matrix.immutable.ImmutableMatrixFactory;
import hu.kazocsaba.math.matrix.immutable.ImmutableVector;
/**
* A finite line segment. It is specified with its end points.
* @author Kazó Csaba
*/
public class Segment {
protected static final double EPS=1e-8;
private final ImmutableVector p1, p2;
private final ImmutableVector dir;
Segment(Vector p1, Vector p2) {
this.p1 = ImmutableMatrixFactory.copy(p1);
this.p2 = ImmutableMatrixFactory.copy(p2);
dir = ImmutableMatrixFactory.copy(this.p2.minus(this.p1));
if (dir.norm()
© 2015 - 2025 Weber Informatics LLC | Privacy Policy