1 /*
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
105 // return null;
106 // }
107 //
108 // Point2D pt = new Point2D(screenX, screenY);
109 // final SubScene subScene = NodeHelper.getSubScene(n);
110 // if (subScene != null) {
111 // pt = SceneUtils.sceneToSubScenePlane(subScene, pt);
112 // if (pt == null) {
113 // return null;
114 // }
115 // }
116 //
117 // // compute pick ray
118 // final Camera cam = subScene != null
119 // ? SubSceneHelper.getEffectiveCamera(subScene)
120 // : SceneHelper.getEffectiveCamera(scene);
121 // final PickRay pickRay = cam.computePickRay(pt.getX(), pt.getY(), null);
122 //
123 // // convert it to node's local pickRay
124 // final Affine3D localToSceneTx = new Affine3D();
125 // n.getLocalToSceneTransform().impl_apply(localToSceneTx);
126 // try {
127 // Vec3d origin = pickRay.getOriginNoClone();
128 // Vec3d direction = pickRay.getDirectionNoClone();
129 // localToSceneTx.inverseTransform(origin, origin);
130 // localToSceneTx.inverseDeltaTransform(direction, direction);
131 // } catch (NoninvertibleTransformException e) {
132 // return null;
133 // }
134 //
135 // // compute the intersection
136 // final PickResultChooser result = new PickResultChooser();
137 // impl_computeIntersects(pickRay, result);
138 // if (result.getIntersectedNode() == n) {
139 // return result.getIntersectedPoint();
140 // }
141 //
142 // // there is none, use point on projection plane instead
143 // final Point3D ppIntersect = CameraAccess.getCameraAccess().pickProjectPlane(cam, pt.getX(), pt.getY());
144 // return n.sceneToLocal(ppIntersect);
145 // }
|
1 /*
2 * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
105 // return null;
106 // }
107 //
108 // Point2D pt = new Point2D(screenX, screenY);
109 // final SubScene subScene = NodeHelper.getSubScene(n);
110 // if (subScene != null) {
111 // pt = SceneUtils.sceneToSubScenePlane(subScene, pt);
112 // if (pt == null) {
113 // return null;
114 // }
115 // }
116 //
117 // // compute pick ray
118 // final Camera cam = subScene != null
119 // ? SubSceneHelper.getEffectiveCamera(subScene)
120 // : SceneHelper.getEffectiveCamera(scene);
121 // final PickRay pickRay = cam.computePickRay(pt.getX(), pt.getY(), null);
122 //
123 // // convert it to node's local pickRay
124 // final Affine3D localToSceneTx = new Affine3D();
125 // TransformHelper.apply(n.getLocalToSceneTransform(), localToSceneTx);
126 // try {
127 // Vec3d origin = pickRay.getOriginNoClone();
128 // Vec3d direction = pickRay.getDirectionNoClone();
129 // localToSceneTx.inverseTransform(origin, origin);
130 // localToSceneTx.inverseDeltaTransform(direction, direction);
131 // } catch (NoninvertibleTransformException e) {
132 // return null;
133 // }
134 //
135 // // compute the intersection
136 // final PickResultChooser result = new PickResultChooser();
137 // impl_computeIntersects(pickRay, result);
138 // if (result.getIntersectedNode() == n) {
139 // return result.getIntersectedPoint();
140 // }
141 //
142 // // there is none, use point on projection plane instead
143 // final Point3D ppIntersect = CameraAccess.getCameraAccess().pickProjectPlane(cam, pt.getX(), pt.getY());
144 // return n.sceneToLocal(ppIntersect);
145 // }
|