klein static method

void klein(
  1. double v,
  2. double u,
  3. Vector3 target
)

Implementation

static void klein(double v, double u, Vector3 target ) {
	u *= math.pi;
	v *= 2 * math.pi;

	u = u * 2;
	double x, z;
	if ( u < math.pi ) {
		x = 3 * math.cos( u ) * ( 1 + math.sin( u ) ) + ( 2 * ( 1 - math.cos( u ) / 2 ) ) * math.cos( u ) * math.cos( v );
		z = - 8 * math.sin( u ) - 2 * ( 1 - math.cos( u ) / 2 ) * math.sin( u ) * math.cos( v );
	} else {
		x = 3 * math.cos( u ) * ( 1 + math.sin( u ) ) + ( 2 * ( 1 - math.cos( u ) / 2 ) ) * math.cos( v + math.pi );
		z = - 8 * math.sin( u );
	}

	final y = - 2 * ( 1 - math.cos( u ) / 2 ) * math.sin( v );

	target.setValues( x, y, z );
}