Jump to content

Overlapping Curves Offset with PointCloud?


Recommended Posts

Hello everyone,

I have banging my head about the following set up: I have many curves overlapping each others and need to offset one of the two at the intersecting points like in the attached. I have tried both with pcfind and pcopen and succeded to find an array of points that represent the intersection areas. The problem now is how do i chose only one of the points in the 'group' and only offset that one in the y axes so to have one curve over the other?

Any other easier/faster method would be much appretiated. I also tried to get the intersection points from intersection analysys SOP but it deletes the original geometry and curvesect SOP only seems to work between 2 curves.

Thank you very much
W

OverlappingCurves.jpg

OverlappingLines.hip

Edited by whitecanvas
Link to comment
Share on other sites

You could ask whether nearpoints() within a certain radius come from a higher numbered primitive. And if they do, apply the radius minus their distance to your point´s height.

float r = chf('radius');
int pts_near[] = nearpoints(0, v@P, r);

float rise = 0.0;
foreach(int pt; pts_near){
    int pr_other = pointprims(0, pt)[0];
    if(pr_other > i@primnum){
        vector pos = point(0, 'P', pt);
        float dist = r - distance(v@P, pos);
        if(dist > rise){
            rise = dist;
        }
    }
}
v@P.y = rise;

bridges.hiplc

Edited by konstantin magnus
The refine node removes unnecessary points.
Link to comment
Share on other sites

Thank you Konstantin, that get me close. I wanted to to something like that but i didn't know how, i  am still pretty new to vex. What if i wanted to animate the curves with a carve and have always the one reaching the other which is already passed, to go over? Also, what if a third line happens to overlap?How to get that to get its P.y to go over both of the previous?

 

Thank you, you help is crucial and appreciated!

Link to comment
Share on other sites

You can build bridges over bridges by stacking straight lines and using the number of ray hits downwards as height:

 // The space around the lines
float tol = chf('tolerance');

// Attributes we dont use, but are required for the intersect_all function.
vector ray_pos[]; int ray_prim[]; vector ray_uvw[];

// Ray direction and length reaching to the floor.
vector dir = v@P * {0, -1, 0}; 

// Slightly shifted starting position so it doesnt shoot itself.
vector pos = v@P - {0, 0.1, 0}; 

// Shooting ray and counting hits on other lines.
int rays = intersect_all(0, pos, dir, ray_pos, ray_prim, ray_uvw, tol, 0.01); 

// The number of hits is used to stack points of lines on top of each other.
v@P.y = float(rays) * 0.1; 

bridges_over_bridges.hiplc

Edited by konstantin magnus
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...