Generating Points around a point

   1209   10   0
User Avatar
Member
10 posts
Joined: 9月 2022
Offline
Hello, I wanted to ask for help
Is there a way to generate points as I show in the image?
I need them to be generated around the corner points but keep the shape the same

Attachments:
houdinifor.jpg (122.2 KB)

User Avatar
Member
677 posts
Joined: 2月 2017
Offline
Hey Cola8,

I would suggest a bevel set to crease with two divisions. Unfortunately in my test, it yields an undesired result for a square curve. for poly, it works fine. maybe you could start with a poly do the bevel and then convert it to a curve. (you can use the LABs tool edge group to curve for that.)

Or if you need to use the curve, convert it to a poly with the fill node. After that use a blast and blast Primitive 0 (the curve). then do the bevel and convert it back to a curve with the LABS tool.

Cheers
CYTE
Edited by CYTE - 2023年4月17日 13:14:30
User Avatar
Member
10 posts
Joined: 9月 2022
Offline
Hey Cyte,
I get this error once I want to bevel the poly surface

Attachments:
forum.jpg (9.2 KB)

User Avatar
Member
4495 posts
Joined: 2月 2012
Offline
Hi,

You can do this easily using a primitive wrangle:

float ndist = ch("distance");

int isclosed = primintrinsic ( 0, "closed", @primnum );
string polytype = isclosed ? "poly" : "polyline";

int primpts [ ] = primpoints ( 0, @primnum );
vector pos [ ] = { };
foreach ( int pt; primpts )
{
    vector p = point ( 0, "P", pt );
    append ( pos, p );
}

int count = len ( primpts );
int sharedpts = 0;
if ( primpts [ 0 ] != primpts [ -1 ] )
{
    if ( isclosed )
    {
        append ( primpts, primpts [ 0 ] );
        append ( pos, pos [ 0 ] );
    }
}
else
{
    count -= 1;
    if ( !isclosed )
        sharedpts = 1;
}

int newprimpts [ ] = { };
for ( int i = 0; i < count; ++i )
{
    vector p0 = pos [ i ];
    vector p1 = pos [ i + 1 ];
    
    vector pnew0 = lerp ( p0, p1, ndist );
    vector pnew1 = lerp ( p0, p1, 1 - ndist );
    
    int pt0 = addpoint ( 0, pnew0 );
    int pt1 = addpoint ( 0, pnew1 );
    
    append ( newprimpts, primpts [ i ] );
    append ( newprimpts, pt0 );
    append ( newprimpts, pt1 );
}

if ( sharedpts )
    append ( newprimpts, primpts [ 0 ] );

removeprim ( 0, @primnum, 0 );
addprim ( 0, polytype, newprimpts );

Edited by animatrix_ - 2023年4月17日 13:50:59
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
677 posts
Joined: 2月 2017
Offline
Cola8
Hey Cyte,
I get this error once I want to bevel the poly surface
try a fuse after the fill.
User Avatar
Member
677 posts
Joined: 2月 2017
Offline
@animatrix,

your solution produces a new point at zero for me? any way to prevent that?

Cheers
CYTE
Edited by CYTE - 2023年4月17日 13:26:45

Attachments:
animatrix_crease.hip (78.1 KB)

User Avatar
Member
10 posts
Joined: 9月 2022
Offline
Hey, I am not yet experienced with coding in Houdini @animatrix,
I've tried your code and all the extra points are stacked on each other.

@CYTE
I've tried a few solutions but all of them give me the same result where nothing changes.
Maybe it has something to do that the shape is linked with different attributes. I am practicing procedural modeling.
Edited by Cola8 - 2023年4月17日 13:36:04

Attachments:
Gazebo.jpg (28.2 KB)
frm.jpg (147.6 KB)

User Avatar
Member
4495 posts
Joined: 2月 2012
Offline
CYTE
@animatrix,

your solution produces a new point at zero for me? any way to prevent that?

Cheers
CYTE

Yes I think your curve is unrolled with shared points so point 0 is used twice in the polyline. So to make it work as is, put an Ends SOP before the primitive wrangle, with Close U set to Close Straight and then another Ends SOP after the primitie wrangle with Close U set to Unroll with Shared Points.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
User Avatar
Member
677 posts
Joined: 2月 2017
Offline
@Cola8,
make sure to set the group type on the bevel node to points.

Cheers
CYTE
Edited by CYTE - 2023年4月17日 13:39:35
User Avatar
Member
10 posts
Joined: 9月 2022
Offline
@CYTE,
Yessss, I just realised this, thank you, both of you!
User Avatar
Member
4495 posts
Joined: 2月 2012
Offline
Cola8
Hey, I am not yet experienced with coding in Houdini @animatrix,
I've tried your code and all the extra points are stacked on each other.

It would help to see your geometry because there are a lot of nuanced differences between polygonal curves in Houdini.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | animatrix2k7.gumroad.com
  • Quick Links