Face pointing towards the camera?
-
@adamb said:
But thats much more work than a dot product. Your turning an orientation problem into something its not.
I'm not seeing how a dot product solves the problem. Could you articulate or maybe Sketch something Up?
-
The result of the dot product can be used to determine if its the front or back side pointing towards the camera.
t = ph.transformation_at(index) n = picked.normal.transform(t).normalize # global vector orientation c = Sketchup.active_model.active_view.camera.direction m = (c % n > 0) ? e.back_material : e.materialIf the dot product is positive then the backface is facing the camera, otherwise it's the front side.
-
@thomthom said:
The result of the dot product can be used to determine if its the front or back side pointing towards the camera.
t = ph.transformation_at(index) n = picked.normal.transform(t).normalize # global vector orientation c = Sketchup.active_model.active_view.camera.direction m = (c % n > 0) ? e.back_material : e.materialIf the dot product is positive then the backface is facing the camera, otherwise it's the front side.
Who is
ph? Who ispicked? -
phis thePickHelperI used andpickedis the face picked.It was taken from my test code.
this is a more condensed sample:
back_side = camera.direction % global_face_normal > 0 -
@thomthom said:
Any clues to how to determine that?
Check my FrontFace.
I just compare normals. The global transformation problem is solved by shooting a ray. That allows you to get an array of all parents of a face.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement