public void rotate(Quaternion rotation, Point3D pivot1) {
		if (pivot1==null) {
			rotate(rotation);
		} else {
			Transform3D m = new Transform3D();
			m.setRotation(rotation);

			// Translate to the pivot
			this.getP1().setX(this.getP1().getX() - pivot1.getX());
			this.getP1().setY(this.getP1().getY() - pivot1.getY());
			this.getP1().setZ(this.getP1().getZ() - pivot1.getZ());

			m.transform(this.getP1());

			this.getP1().setX(this.getP1().getX() + pivot1.getX());
			this.getP1().setY(this.getP1().getY() + pivot1.getY());
			this.getP1().setZ(this.getP1().getZ() + pivot1.getZ());

			// Rotate the direction
			m.transform(this.getSegmentVector());
			this.getSegmentVector().normalize();
		}
	}
public void rotate ( Quaternion rotation , Point3D pivot1 ) { if ( pivot1 == null ) { rotate ( rotation ) ; } else { Transform3D m = new Transform3D ( ) ; m . setRotation ( rotation ) ; this . getP1 ( ) . setX ( this . getP1 ( ) . getX ( ) - pivot1 . getX ( ) ) ; this . getP1 ( ) . setY ( this . getP1 ( ) . getY ( ) - pivot1 . getY ( ) ) ; this . getP1 ( ) . setZ ( this . getP1 ( ) . getZ ( ) - pivot1 . getZ ( ) ) ; m . transform ( this . getP1 ( ) ) ; this . getP1 ( ) . setX ( this . getP1 ( ) . getX ( ) + pivot1 . getX ( ) ) ; this . getP1 ( ) . setY ( this . getP1 ( ) . getY ( ) + pivot1 . getY ( ) ) ; this . getP1 ( ) . setZ ( this . getP1 ( ) . getZ ( ) + pivot1 . getZ ( ) ) ; m . transform ( this . getSegmentVector ( ) ) ; this . getSegmentVector ( ) . normalize ( ) ; } }
Rotate the segment around a given pivot point.
The default pivot point of the segment is its first point.

@param rotation the rotation.
@param pivot1 the pivot point. If <code>null</code> the default pivot point is used.