[Sidefx-houdini-list] pcfilter point number

Olex P hoknamahn at gmail.com
Thu Aug 4 05:35:16 EDT 2011


Hi guys,

Hi guys, the first entry in a point cloud lookup is always a nearest
point. A following snipet of code will give you the number of nearest
point and a distance to it

[code]
sop
pcnearest(string       pcfile  = "";
                float        radius = 1.0f;

                export int   num = -1;
                export float dist  = -1.0f)
{
    int handle = pcopen(pcfile, "P", P, radius, 1);

    if(pciterate(handle))
    {
        pcimport(handle, "point.number",   num);
        pcimport(handle, "point.distance", dist);
    }

    pcclose(handle);
}
[/code]

On Wed, Aug 3, 2011 at 9:14 PM, Alvaro Castaneda <varomix at gmail.com> wrote:
> I think you're trying to do something more complex than it need to be
> we get sometimes caught in that, but always the best thing is a simple
> solution
> simple to develop and simple to use.
>
> Cheers
>
>
>
> 
>
>  *.:varomix:.*
> MIX Studio
> 3D Artist/Generalist TD
> www.varomix.net
>  My profiles: [image: LinkedIn] <http://www.linkedin.com/in/varomix> [image:
> Twitter] <http://twitter.com/varomix> [image:
> Facebook]<http://www.facebook.com/varomix>
> On Wed, Aug 3, 2011 at 2:00 PM, Nick van Zutphen <nvanzutphen at live.com>wrote:
>
>> @ Andrew
>> Ghehe, well with all due respect but your solution, compared to what I was
>> doing, is almost ridiculous due to its simplicity. But I like it! :-). It
>> works perfectly. Thanks a lot.
>>
>> @Mike
>> I have to keep this in mind because I'm pretty sure I'll run in to this one
>> again. Pcfilter works perfect if you would like to get position of 1 or
>> especially an average of multiple points, to bad it doesn't do the trick in
>> this case. Thank you for your input, it's much appreciated. Though Andrews
>> solution is, in this particular case, the way to go.
>>
>> Case closed, (with that paper file and red 'case closed' stamp on it ;-)
>> Nick van Zutphen
>> ------------------------------**--------------------
>> From: "Andrew Lyons" <tstexture at gmail.com>
>> Sent: Wednesday, August 03, 2011 9:12 PM
>>
>> To: <sidefx-houdini-list at sidefx.**com <sidefx-houdini-list at sidefx.com>>
>> Subject: Re: [Sidefx-houdini-list] pcfilter point number
>>
>>  Not totally clear on the problem - but I've always used the attribTransfer
>>> SOP to get near points:
>>>
>>> 1./ Create custom point "ptnum" int attr. Store $PT in there.
>>> 2./ attrTransfer ptnum to new geometry. (Set "Max Sample Count" set to 2
>>> if
>>> feeding same SOP into both inputs. Set to 1 otherwise.)
>>>
>>> Cheers
>>>
>>> On 3 August 2011 11:32, <mdunkley at gmail.com> wrote:
>>>
>>>  Hey Nick -
>>>>
>>>> I've had some fiddly problems using pcfilter for point numbers in the
>>>> past.
>>>> I was attempting to create a float point number variable called ptnum and
>>>> just look it up with no interpolation (ie 1 point lookup) from pcfilter,
>>>> but
>>>> even then i would often get incorrect values - I think the filter is
>>>> doing
>>>> some kind of filtering no matter what. Sometimes the ptnum value it
>>>> returned
>>>> would just be a number off, as if it was getting ceil'ed or floor'ed,
>>>> some
>>>> times it came back with a floating point component, so clearly there was
>>>> some sort of interpolation happening.
>>>>
>>>> I can say for sure that the other method you mentioned *does* work.
>>>> Pciterate doesn't really do anything on its own - you need it to feed a
>>>> while loop (both ouside the loop, and then again on the inside). Within
>>>> the
>>>> while, you can then use pcimport with "point.number" / "point.distance"
>>>> to
>>>> pull all that info out. My impression of pcfilter is that its just a
>>>> quick
>>>> and dirty one-stop-shop way to slew values between points, not to
>>>> intended
>>>> to work with the other point cloud functions - if you need to do anything
>>>> very specific you'll have to roll your own with pciterate and a while
>>>> loop.
>>>>
>>>> If you haven't seen it, check out peter quint's point cloud videos on
>>>> vimeo
>>>> - the second one talks very specifically about some of the issues related
>>>> to
>>>> making your own:
>>>> http://vimeo.com/9108284
>>>>
>>>> Best,
>>>> Mike
>>>>
>>>>
>>>>
>>>> On , Nick van Zutphen <nvanzutphen at live.com> wrote:
>>>>
>>>>  I like to stay close to 'SESI' guidelines, or like the default tools
>>>>> work
>>>>> (something I inherited from my intenship). I guess giving a position
>>>>> vector,
>>>>> which can also be set by using a handle is pretty close to that.
>>>>> Obviously
>>>>> using a sphere would work, but it's not very neat, is it?
>>>>>
>>>>>
>>>>
>>>>
>>>>  Cheers,
>>>>
>>>>>
>>>>>
>>>>  Nick van Zutphen
>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>  ------------------------------****--------------------
>>>>
>>>>>
>>>>>
>>>>  From: "Alvaro Castaneda" varomix at gmail.com>
>>>>
>>>>>
>>>>>
>>>>  Sent: Wednesday, August 03, 2011 6:21 PM
>>>>
>>>>>
>>>>>
>>>>  To: sidefx-houdini-list at sidefx.com****>
>>>>
>>>>>
>>>>>
>>>>  Subject: Re: [Sidefx-houdini-list] pcfilter point number
>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>  This might be a dumb idea, but why don't you
>>>>
>>>>>
>>>>>
>>>>  ask the user to place a sphere for initial position
>>>>
>>>>>
>>>>>
>>>>  use that to grab any points inside and start from there?
>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>  I can use that :)
>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>  
>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>  *.:varomix:.*
>>>>
>>>>>
>>>>>
>>>>  MIX Studio
>>>>
>>>>>
>>>>>
>>>>  3D Artist/Generalist TD
>>>>
>>>>>
>>>>>
>>>>  www.varomix.net
>>>>
>>>>>
>>>>>
>>>>  My profiles: [image: LinkedIn] http://www.linkedin.com/in/****varomix<http://www.linkedin.com/in/**varomix>
>>>> <http://www.linkedin.**com/in/varomix<http://www.linkedin.com/in/varomix>
>>>> >>
>>>>
>>>>> [image:
>>>>>
>>>>>
>>>>  Twitter] http://twitter.com/varomix> [image:
>>>>
>>>>>
>>>>>
>>>>
>>>> Facebook]http://www.facebook.****com/varomix<http://www.**
>>>> facebook.com/varomix <http://www.facebook.com/varomix>>
>>>>
>>>>> >
>>>>>
>>>>>
>>>>  On Wed, Aug 3, 2011 at 10:06 AM, Nick van Zutphen nvanzutphen at live.com
>>>>
>>>>> >wrote:
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>  Hi!
>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>  I finally figured out how this maillist thing works :-), at least I hope
>>>>
>>>>>
>>>>>
>>>>  so. It feels a bit like 'you're used to Internet, and you have to use
>>>> 'the
>>>>
>>>>>
>>>>>
>>>>  wire', telex or how ever it's called in English' ;-).
>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>  I'm working on a tool which operates on scattered points and it needs a
>>>>
>>>>>
>>>>>
>>>>  starting point. I would like to give the user the ability to specify a
>>>>
>>>>>
>>>>>
>>>>  position vector and the tool will figure out what the closest point is.
>>>>
>>>>> This
>>>>>
>>>>>
>>>>  becomes need when you would like to start in a certain area and the
>>>> points
>>>>
>>>>>
>>>>>
>>>>  might change due to a different seed or what so ever.
>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>  I think of a pointcloud method, however I'm interested in the closest
>>>>
>>>>> point
>>>>>
>>>>>
>>>>  pointnumber. I know pciterate has the option point.number but that
>>>> doesn't
>>>>
>>>>>
>>>>>
>>>>  seem to work on pcfilter and ptnum doesn't give any luck either. I would
>>>>
>>>>>
>>>>>
>>>>  like to use pcfilter since it's about a single point and iterating over
>>>> 1
>>>>
>>>>>
>>>>>
>>>>  point doesn't seem to make much sense.
>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>  So my question is: 'Is there a way to get the point number when using
>>>>
>>>>>
>>>>>
>>>>  pcfilter. If not, what's the alternative?'
>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>  Cheers!
>>>>
>>>>>
>>>>>
>>>>  Nick van Zutphen
>>>>
>>>>>
>>>>>
>>>>  ______________________________****_________________
>>>>
>>>>>
>>>>>
>>>>  Sidefx-houdini-list mailing list
>>>>
>>>>>
>>>>>
>>>>  Sidefx-houdini-list at sidefx.com
>>>>
>>>>>
>>>>>
>>>>
>>>> https://lists.sidefx.com:443/****mailman/listinfo/sidefx-****
>>>> houdini-list<https://lists.sidefx.com:443/**mailman/listinfo/sidefx-**houdini-list>
>>>> <https://lists.**sidefx.com:443/mailman/**listinfo/sidefx-houdini-list<https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list>
>>>> >
>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>  ______________________________****_________________
>>>>
>>>>>
>>>>>
>>>>  Sidefx-houdini-list mailing list
>>>>
>>>>>
>>>>>
>>>>  Sidefx-houdini-list at sidefx.com
>>>>
>>>>>
>>>>>
>>>>
>>>> https://lists.sidefx.com:443/****mailman/listinfo/sidefx-****
>>>> houdini-list<https://lists.sidefx.com:443/**mailman/listinfo/sidefx-**houdini-list>
>>>> <https://lists.**sidefx.com:443/mailman/**listinfo/sidefx-houdini-list<https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list>
>>>> >
>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>  ______________________________****_________________
>>>>
>>>>>
>>>>>
>>>>  Sidefx-houdini-list mailing list
>>>>
>>>>>
>>>>>
>>>>  Sidefx-houdini-list at sidefx.com
>>>>
>>>>>
>>>>>
>>>>
>>>> https://lists.sidefx.com:443/****mailman/listinfo/sidefx-****
>>>> houdini-list<https://lists.sidefx.com:443/**mailman/listinfo/sidefx-**houdini-list>
>>>> <https://lists.**sidefx.com:443/mailman/**listinfo/sidefx-houdini-list<https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list>
>>>> >
>>>>
>>>>>
>>>>>
>>>>
>>>> ______________________________****_________________
>>>> Sidefx-houdini-list mailing list
>>>> Sidefx-houdini-list at sidefx.com
>>>> https://lists.sidefx.com:443/****mailman/listinfo/sidefx-****
>>>> houdini-list<https://lists.sidefx.com:443/**mailman/listinfo/sidefx-**houdini-list>
>>>> <https://lists.**sidefx.com:443/mailman/**listinfo/sidefx-houdini-list<https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list>
>>>> >
>>>>
>>>>
>>>
>>>
>>> --
>>> ==============================**=========
>>> Andrew D Lyons | Digital Artist | http://www.tstex.com
>>> ==============================**=========
>>> ______________________________**_________________
>>> Sidefx-houdini-list mailing list
>>> Sidefx-houdini-list at sidefx.com
>>> https://lists.sidefx.com:443/**mailman/listinfo/sidefx-**houdini-list<https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list>
>>>
>>>  ______________________________**_________________
>>
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
>> https://lists.sidefx.com:443/**mailman/listinfo/sidefx-**houdini-list<https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list>
>>
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>



More information about the Sidefx-houdini-list mailing list