# Strange results from a simple if statement?

 12 December 2008 Wrench   portfolio Luca Guareschi Freelancer United Kingdom Strange results from a simple if statement? Hi all I am very new to maxscript and am receiving really wierd results from a simple if statement, I cannot understand what I am doing wrong so forgive me if this may seem trivial to you. What I am doing is generating a random amount of faces, some that are perpendicular to the z-axis and others that are not. Problem is, at random intervals the statement returns false when in actual fact it should be returning true. This is happening even if all face normals are exactly the same. for i=1 to faceNum do ( p = polyOp.getFaceNormal \$ i if p == [0, 0, 1] then ( print "true" ) else ( print "false" ) ) At the moment p = [0,0,1] at every increment of i and yet I am still getting falses every now and again. What am I doing wrong? Thanks in advance Luca share quote
 12 December 2008 PiXeL_MoNKeY Expert   Eric Craft Dallas, USA Originally Posted by Maxscript Reference: Returns the face normal of the face. If is a node, or if is an Editable Poly and is specified, the direction vector returned is in the current coordinate system context. If is an Editable Poly and is not specified, the return value is in the poly's local coordinate system. According to the help the direction returned is the current coordinate system, so what coordinate system are you working in? -Eric __________________ "The Evil Monkey hiding in your closet." share quote
 12 December 2008 Wrench   portfolio Luca Guareschi Freelancer United Kingdom Thanks for the speedy reply Pixel_monkey. Well I havent specified node so I would pressume it is the poly's local co-ordinate system that I am working in. What confuses me is that for every instance that I print 'p' ( about 500 times) it returns constantly a value equal to [0,0,1] and yet it returns random false statements when in effect that should never be happening. share quote
 12 December 2008 drdubosc Permanently surprised   J Robin Betts United Kingdom Hi, it's not a problem with the 'if', it's a precision and display problem. For example you can do this in the listener: f = 1.000001 1.0 p = [0,0,f] [0,0,1] p == [0,0,1] false Check out Bobo's answers to this thread for a good explanation share quote
 12 December 2008 Wrench   portfolio Luca Guareschi Freelancer United Kingdom aaahhh, thanks so much for the help dr. I really appreciate it. share quote
 12 December 2008 CGTalk Moderation Expert Thread automatically closed This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 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 CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.