zarquon42b / Rvcg

R-package providing mesh manipulation routines from VCGLIB
Other
25 stars 10 forks source link

signed distances are not calculated if distance is >1e5 #10

Closed jefferis closed 7 years ago

jefferis commented 7 years ago

I am working with some electron microscopy data calibrated in nm. I am using signed distance with vcgClostKD to determine if points are inside a mesh. Some of my distances from points outside the mesh are greater than 1E5.

Unfortunately 1E5 is being used as a signalling value in some contexts to mean out of range. The lines below effectively assumes that all distances are <1E5.

https://github.com/zarquon42b/Rvcg/blob/d6896037a1af80f6e4d36eab6cc59ecd29efd4bd/src/RvcgKD.h#L188-L193

would it perhaps be possible to use a NAN/Inf or other signalling procedure?

zarquon42b commented 7 years ago

Hi Jeff, I will look into this.

zarquon42b commented 7 years ago

Fixed in https://github.com/zarquon42b/Rvcg/commit/63329d01827c267d4ad07dbfe7b182b30601c5a7: Set max dist to 1e12 and all beyond to NaN. Please test and close issue if you deem it fixed.

jefferis commented 7 years ago

Thanks a lot. I'll take a look later but based on the code change I think this will work for me.

jefferis commented 7 years ago

Thanks again!

jefferis commented 7 years ago

PS @zarquon42b do you have any plans for a CRAN release in the near future?

zarquon42b commented 7 years ago

If you need it, I will make one. No big deal.

jefferis commented 7 years ago

Thank you! Would be very handy as Rvcg is a dependency for my packages and most of my users are on mac and do not have a development environment set up but can use binary packages from CRAN.

zarquon42b commented 7 years ago

Hi Greg, FYI: it is now on CRAN Best Stefan