SvenP Posted July 9, 2005 Share Posted July 9, 2005 I am trying to get the distance between a point p and the nearest point in a pointcloud.Ive already tried everything i can think of in the last few hours to get the problem solved but the function always returns a value of 0 Ok heres the code maybe someone of you can help me. Thanks in advance Sven float PC_GetDensity(string file ;vector mp;float r) { float d,temp_d; int handle; d=1000; handle = pcopen(file,"P",mp,r,10); while ( pciterate(handle) ) { if( pcimport(handle,"point.distance",temp_d)) { if( temp_d < d ) { d=temp_d; } } } if (d <= r) { return(d); } else { return(0); } } Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 9, 2005 Share Posted July 9, 2005 Hi Sven, I can't see anything obviously wrong with your function. So just throwing out a few suggestions. The obvious question is there something wrong with the way it is called. Ie how does r get set? It might be worth sticking a few "printf"s in there to see what values are getting returned, that might help you track down the problem. Have you checked that the file path to your cloud is a correct path? If this in a sop you need to use the full path. And if it's in a shader it has to be a path to an existing disk bgeo or tbf, I don't think you can use the op: path syntax. (not 100% sure about that though) Also, have you made sure mp is in object space? mp = wo_space(P); Quote Link to comment Share on other sites More sharing options...
SvenP Posted July 9, 2005 Author Share Posted July 9, 2005 Oh well actually i never got the printf output working on windows Maybe someone can help me with this too . oh and heres the part where the function gets called : for (i = 0;i < steps; i++) { os_marchpoint = wo_space(marchpoint); dnoise += density_function(marchpoint,distance(os_marchpoint,{0,0,0})); density += PC_GetDensity ( filename,os_marchpoint,radius); marchpoint += dir; } Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 10, 2005 Share Posted July 10, 2005 to use printf on windows in a shader just add a line like printf("os_marchpoint %g \n", os_marchpoint); then in the renderer set the output to verbose and set a file for the output. mantra -V 1 -o "C:\Temp\debug.txt" Another good way to debug is to create an exported parameter and output that in a deep raster. So in your parameter list add export float foo = 0; then set foo to something useful, and in the deep raster tab set foo as one of your deep rasters. One final thing, I've had problems on windows where a shader will only return 1 for the whole shader and it's turned out to be an otl issue, depending on how the shader was created. If you have your code in an otl it might be worth trying to resave it to another otl that sometimes kicks it back into life. Quote Link to comment Share on other sites More sharing options...
SvenP Posted July 10, 2005 Author Share Posted July 10, 2005 Good to know . Thank you very much Sven Quote Link to comment Share on other sites More sharing options...
SvenP Posted July 10, 2005 Author Share Posted July 10, 2005 Well it seems that the otl was the problem Sven Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 10, 2005 Share Posted July 10, 2005 I've tried reporting it as a bug, but it's not repeatable since the act of sending it causes it to be fixed. Good to know someone else has seen it. Maybe Sesi will believe me now. Can I ask how you made the otl? was it with vcc or from the file menu? Quote Link to comment Share on other sites More sharing options...
SvenP Posted July 10, 2005 Author Share Posted July 10, 2005 With VCC ( i am using Cutter for developing shaders ) actually it looks like if i write a shader that doesnt use pointclouds compile that into an otl and then add pointcloud functions and recompile into the same otl this happens. if i delete the otl and then compile it works. i will try to make a without and a with pointcloud functions shader that makes the problem repeatable by compiling them . Sven Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 10, 2005 Share Posted July 10, 2005 What's Cutter? Quote Link to comment Share on other sites More sharing options...
SvenP Posted July 10, 2005 Author Share Posted July 10, 2005 Cutter is an IDE for writting VEX/RSL/MEL/Shake Script/TCL/C sourcecode. http://www.fundza.com/ if you try it out add the houdini/bin/ dir to your path or the compiling wont work Heres a screenshot : Sven Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 10, 2005 Share Posted July 10, 2005 Cool. Thanks for the link, looks interesting. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 11, 2005 Share Posted July 11, 2005 Cutter is an IDE for writting VEX/RSL/MEL/Shake Script/TCL/C sourcecode. 19397[/snapback] At the risk of sounding antiquated (or should that be "antediluvian"?), I would heartily recommend VIM (or gVim) Quote Link to comment Share on other sites More sharing options...
AdamJ Posted July 11, 2005 Share Posted July 11, 2005 one more to the mix... jedit. Usually end up going between gvim and jedit. jedit Quote Link to comment Share on other sites More sharing options...
SvenP Posted July 11, 2005 Author Share Posted July 11, 2005 Why do you prefer Vim over Cutter Mario ? I never tried vim but cutter does a good job for me . All i sometimes miss is the ability to fold/unfold functions for a better overview in bigger shaders. Sven Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted July 11, 2005 Share Posted July 11, 2005 Hey Sven, Why do you prefer Vim over Cutter Mario ? 19422[/snapback] Heh... I never said I preferred it *over* cutter (esp. since I've never used cutter)... I was just offering it up as another good text editor worth checking out. Vim (and its predecessor VI) takes some getting used to, no doubt. It's all keyboard based so it's interface is, uhmm... "unintuitive" shall we say? But once you get to know it... wow... everything's under your fingers, so you're just flying! Editting becomes insanely fast and flexible... but maybe the whole keyboard thing only appeals to old farts like me Anyway; check it out if you've got nothing better to do. Quote Link to comment Share on other sites More sharing options...
TheUsualAlex Posted July 11, 2005 Share Posted July 11, 2005 lol I am a new fart and I like Vim too. Now I am not as fast at it tho... Quote Link to comment Share on other sites More sharing options...
Wolfwood Posted July 11, 2005 Share Posted July 11, 2005 But once you get to know it... wow... everything's under your fingers, so you're just flying! Editting becomes insanely fast and flexible... but maybe the whole keyboard thing only appeals to old farts like me The later versions of gvim (vim) are pretty mouse friendly. I'm still a fresh fart so I use the mouse a good bit to navigate through files in vim. If I find myself using a menu all the time I break down and learn the keyboard command for it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.