graphics.raytrace/src/main/java/org/intranet/graphics/raytrace/shape/TubeLike.java
final boolean checkCap(Ray ray, double t, double radius)
	{
		Point rayOrigin = ray.getOrigin();
		Vector rayDirection = ray.getDirection();
		double x = rayOrigin.getX() + t * rayDirection.getX();
		double z = rayOrigin.getZ() + t * rayDirection.getZ();
		return (x*x + z*z) <= Math.abs(radius);
	}
/** a helper function to reduce duplication.
	* checks to see if the intersection at `t` is within a radius
	* of 1 (the radius of your cylinders) from the y axis.
	*/
a helper function to reduce duplication.
checks to see if the intersection at `t` is within a radius
of 1 (the radius of your cylinders) from the y axis.
a helper function to reduce duplication . checks to see if the intersection at ` t ` is within a radius of 1 ( the radius of your cylinders ) from the y axis .
final boolean checkCap(Ray ray, double t, double radius)
	{
		Point rayOrigin = ray.getOrigin();
		Vector rayDirection = ray.getDirection();
		double x = rayOrigin.getX() + t * rayDirection.getX();
		double z = rayOrigin.getZ() + t * rayDirection.getZ();
		return (x*x + z*z) <= Math.abs(radius);
	}
final boolean checkCap ( Ray ray , double t , double radius ) { Point rayOrigin = ray . getOrigin ( ) ; Vector rayDirection = ray . getDirection ( ) ; double x = rayOrigin . getX ( ) + t * rayDirection . getX ( ) ; double z = rayOrigin . getZ ( ) + t * rayDirection . getZ ( ) ; return ( x * x + z * z ) <= Math . abs ( radius ) ; }
a helper function to reduce duplication.
a helper function to reduce duplication .