Determine vertices with normals facing toward/away from a point?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  08 August 2014
Determine vertices with normals facing toward/away from a point?

I have something that generally sorta-kinda works, but the results are inconsistent enough that I'm questioning my approach. What am I doing wrong?

fn collectFacingVerts obj tgt = (
	fv = #()
	for f in obj.verts as bitArray do (
		p = polyOp.getVert obj f
		v = p - tgt.pos
		if (intersectRay obj (ray p v)) != undefined do append fv f
  08 August 2014
for meshes

fn CollectFacingVerts mObj tgt =
	for v = 1 to mObj.numverts where (dot (tgt - (getVert mObj v))  (getNormal mObj v)) > 0.0 collect v ;
  08 August 2014
Thanks! That not only gets more accurate results, but also has the benefit of being much faster!
reply share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 03:39 AM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.