code: public double getGroundHeight(double x, double y, CoordinateSystem3D system) {
  		assert(system!=null);
  		int idx = system.getHeightCoordinateIndex();
  		assert(idx==1 || idx==2);
  		Point3D p1 = getP1();
  		assert(p1!=null);
  		Vector3D v = getNormal();
  		assert(v!=null);
  
  		if (idx==1 && v.getY()==0.)
  			return p1.getY();
  		if (idx==2 && v.getZ()==0.)
  			return p1.getZ();
  
  		double d = -(v.getX() * p1.getX() + v.getY() * p1.getY() + v.getZ() * p1.getZ());
  
  		if (idx==2)
  			return -(v.getX() * x + v.getY() * y + d) / v.getZ();
  
  		return -(v.getX() * x + v.getZ() * y + d) / v.getY();
  	}
docs: Replies the height of the projection on the triangle that is representing a ground.
  <p>
  Assuming that the triangle is representing a face of a terrain/ground,
  this function compute the height of the ground just below the given position.
  The input of this function is the coordinate of a point on the horizontal plane.
  
  @param x is the x-coordinate on point to project on the horizontal plane.
  @param y is the y-coordinate of point to project on the horizontal plane.
  @param system is the coordinate system to use for determining the up coordinate.
  @return the height of the face at the given coordinate.