In order to view a slice through a 3D object I adjusted the View object
front and back clipping planes.   I previously tried the ModelClip object
but it does not seem to work properly.

public void setZClipDistance(double position) {
  double smalldistance = 40 * scale;
  position = - position * scale;
  view.setFrontClipPolicy(View.VIRTUAL_SCREEN);
  view.setFrontClipDistance(position - smalldistance);
  view.setBackClipPolicy(View.VIRTUAL_SCREEN);
  view.setBackClipDistance(position + smalldistance);
}

This works very well for the purpose, allowing points (inside the main
object) to be viewed.  However, when trying to pick points inside it becomes
obvious that during picking the whole scene is drawn and the clipped area is
being included in the selection.

int x = ((MouseEvent) event[i]).getX();
int y = ((MouseEvent) event[i]).getY();
pickCanvas.setShapeLocation(x, y);

Point3d eyePos = pickCanvas.getStartPosition();
try {
  pickResult = pickCanvas.pickAllSorted();
} catch (RuntimeException e) {
  e.printStackTrace();
}

if (pickResult != null) {
  // Get closest intersection results
  PickIntersection pi = pickResult[0].getClosestIntersection(eyePos);

  // Position sphere at intersection point
  Point3d intPt = pi.getPointCoordinatesVW();
}

It is as if the pickCanvas does not check the clipping planes during
picking.  Is there any other way to exclude the clipped area?

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to