@Test public void isParallel() throws Exception { aStart = GeometryFactory.createVector(0,0); aDirection = GeometryFactory.createVector(1,0); a = GeometryFactory.createRay2D(aStart, aDirection); bStart = GeometryFactory.createVector(1,1); bDirection = GeometryFactory.createVector(1,0); b = GeometryFactory.createRay2D(bStart, bDirection); assertTrue(a.isParallel(b)); bStart = GeometryFactory.createVector(1,1); bDirection = GeometryFactory.createVector(1,1.0001); b = GeometryFactory.createRay2D(bStart, bDirection); assertFalse(a.isParallel(b)); bStart = GeometryFactory.createVector(0,0); bDirection = GeometryFactory.createVector(0,1); b = GeometryFactory.createRay2D(bStart, bDirection); assertFalse(a.isParallel(b)); }
public boolean isParallel(Ray2D other) { return this.getDirection().cross(other.getDirection()) == 0; }
Ray2D { public boolean isParallel(Ray2D other) { return this.getDirection().cross(other.getDirection()) == 0; } }
Ray2D { public boolean isParallel(Ray2D other) { return this.getDirection().cross(other.getDirection()) == 0; } Ray2D(Vector2D start, Vector2D direction); }
Ray2D { public boolean isParallel(Ray2D other) { return this.getDirection().cross(other.getDirection()) == 0; } Ray2D(Vector2D start, Vector2D direction); Vector2D getStart(); void setStart(Vector2D start); Vector2D getDirection(); void setDirection(Vector2D direction); Vector2D intersectionPoint(Ray2D other); Ray2D intersectionRay(Ray2D other); Segment2D intersectionSegment(Ray2D other); boolean contains(Vector2D point); boolean isParallel(Ray2D other); boolean equals(Ray2D other); String toString(); }
Ray2D { public boolean isParallel(Ray2D other) { return this.getDirection().cross(other.getDirection()) == 0; } Ray2D(Vector2D start, Vector2D direction); Vector2D getStart(); void setStart(Vector2D start); Vector2D getDirection(); void setDirection(Vector2D direction); Vector2D intersectionPoint(Ray2D other); Ray2D intersectionRay(Ray2D other); Segment2D intersectionSegment(Ray2D other); boolean contains(Vector2D point); boolean isParallel(Ray2D other); boolean equals(Ray2D other); String toString();  }