-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on changing plane position of slice #399
Comments
Looking very nice! Hmm, I can not seem to see what is not working, the video looks fine to me. Can you maybe try to explain in other words the problem so I understand it better? Thanks! |
It is not so easy to see indeed! The movement is very subtle. |
Oh I see now thanks - How do you get the new plane position? By raycasting the cursor position? |
Yes I am raycasting the cursor point like this:
The point returned is not coplanar with slice. I've already tried to make a projection on planePosition of this point, but it doesn't work either |
That must be the problem. Can you check if the Also, does it work if you do the raycasting against |
It does not work when I do the raycasting against I checked the localizer helper and I am updating like this //Rotate plane method
let axis = renderer.stackHelper.slice.planeDirection
//updateLocalizer method - Update the renderer I am rotating
renderer.localizerHelper.plane1 = [r1,r2,r3].filter(function(e) { if(e!=renderer) return e })[0].stackHelper.slice.cartesianEquation()
renderer.localizerHelper.plane2 = [r1,r2,r3].filter(function(e) { if(e!=renderer) return e })[1].stackHelper.slice.cartesianEquation()
renderer.localizerHelper.referencePlane = renderer.stackHelper.slice.cartesianEquation()
renderer.localizerHelper.geometry = renderer.stackHelper.slice.geometry
for(let otherRenderer of [r1,r2,r3].filter(function(e) { if(e!=renderer) return e })){
//Rotate PLane direction method
let planeDirection = otherRenderer.stackHelper.slice.planeDirection.clone()
planeDirection.applyAxisAngle(axis,angle)
otherRenderer.stackHelper.slice.planeDirection = planeDirection
otherRenderer.stackHelper.border.helpersSlice = otherRenderer.stackHelper.slice
//updateLocalizer method - Update the other rendererers
otherRenderer.localizerHelper.plane1 = [r1,r2,r3].filter(function(e) { if(e!=otherRenderer) return e })[0].stackHelper.slice.cartesianEquation()
otherRenderer.localizerHelper.plane2 = [r1,r2,r3].filter(function(e) { if(e!=otherRenderer) return e })[1].stackHelper.slice.cartesianEquation()
otherRenderer.localizerHelper.referencePlane = otherRenderer.stackHelper.slice.cartesianEquation()
otherRenderer.localizerHelper.geometry = otherRenderer.stackHelper.slice.geometry
//Rotate camera method
for(let direction of otherRenderer.camera._directions){
direction.applyAxisAngle(axis,angle)
}
otherRenderer.camera.update()
} Translating // translateLocalizerToMousePosition method
let raycaster = new THREE.Raycaster();
let camera = renderer.camera
let stackHelper = renderer.stackHelper
let scene = renderer.scene
if(renderer.domId == 'r0'){
stackHelper = r1.stackHelper
}
raycaster.setFromCamera(point, camera);
let intersects = raycaster.intersectObjects(renderer.stackHelper.slice.children, false);
if (intersects.length > 0) {
//translatePlanesToPoint method
let point = CoreUtils.worldToData(renderer.stackHelper.stack.lps2IJK, intersects[0].point);
for(let renderer of [r1,r2,r3]){
renderer.stackHelper.slice.planePosition = point
renderer.stackHelper.border.helpersSlice = renderer.stackHelper.slice
}
for(let renderer of [r1,r2,r3]){
//updateLocalizer method
renderer.localizerHelper.plane1 = [r1,r2,r3].filter(function(e) { if(e!=renderer) return e })[0].stackHelper.slice.cartesianEquation()
renderer.localizerHelper.plane2 = [r1,r2,r3].filter(function(e) { if(e!=renderer) return e })[1].stackHelper.slice.cartesianEquation()
renderer.localizerHelper.referencePlane = renderer.stackHelper.slice.cartesianEquation()
renderer.localizerHelper.geometry = renderer.stackHelper.slice.geometry
}
} |
I am working on a feature that allows users to rotate the localizer helpers of quadview like this video. It is working fine, but after rotation of any 2D renderers, the translation of other renderers is not working fine. The slice of these other renderers is moving, but it should remain the same slice. Watch the video to understand what I am trying to explain. In the video, first I am rotating localizer helper on r2 renderer, and it worked fine. After I am translating the localizer helpers on r2, and observe the slice is not moving, it remains still, like I expected, but when I translate the localizer helper on r1, renderer r1's slice is moving, but it should not be.
How I am rotating (angle is in radian)
How I am translating
I guess there is some error on rounding (Math.ceil or Math.floor) the point that I am setting the planePosition, because it is not coplanar with planePosition and I don't have a clue how to solve this.
The text was updated successfully, but these errors were encountered: