About xyzdist vex function.

   2385   2   1
User Avatar
Member
19 posts
Joined: Nov. 2013
Offline
Hi guys, I'm using xyzdist() vex function in a point wrangle to calculate the distance between a point and a polygon,but the result is wrong ,don't know if it is a bug or something im missing.Need help .

please see the attached pic.

there's 1 point and 1 polygon (with 4points and 1 primitive)in the scene,the point is just at the polygon's corner's position,overlapped with one point of the polygon.the result of the xyzdist() should be 0 ,but it comes out 0.00019 instead.I copied a sphere with 0.00019 radius onto the single point, and you can see the template in the pic.
Iterated through thousands of points ,all of the result is correct except this one and i isolate the point and polygon out into another new scene but the result is the same.Am i missing something ? thanks!
Edited by spoopo - Feb. 14, 2017 00:58:20

Attachments:
Untitled.jpg (84.9 KB)

User Avatar
Member
806 posts
Joined: Oct. 2016
Offline
Moin,

it might be an unhappy math rounding issue with 32bit floating point that only kicks in with those specific position values.
Do you get the same result when channel-linking the position of the point to that of the polygon's point position? If yes, it's a math thing and you may have to do some rounding. If no, then one of the positions is not what you think it is …

Marc
---
Out of here. Being called a dick after having supported Houdini users for years is over my paygrade.
I will work for money, but NOT for "you have to provide people with free products" Indie-artists.
Good bye.
https://www.marc-albrecht.de [www.marc-albrecht.de]
User Avatar
Member
19 posts
Joined: Nov. 2013
Offline
malbrecht
Moin,

it might be an unhappy math rounding issue with 32bit floating point that only kicks in with those specific position values.
Do you get the same result when channel-linking the position of the point to that of the polygon's point position? If yes, it's a math thing and you may have to do some rounding. If no, then one of the positions is not what you think it is …

Marc

Hi Malbrecht ,I add a new point and link the position with the polygon's closest point's position using an expression, and get the same distance value 0.00019.
the distance between the point and the polygon's closest point(number 3)calculated by the distance() function is 1e-07,that seems to be right.
so this case you mean it is an issue about the math ? I think I need to find another away to go.
Thank you for the reply!
  • Quick Links