Overlapping Curves Offset with PointCloud?

   1459   4   0
User Avatar
Member
76 posts
Joined: 2月 2017
Offline
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
Francesco
Edited by ProceduralFrankie - 2018年12月23日 09:43:24

Attachments:
OverlappingLines.hip (135.5 KB)
OverlappingCurves.jpg (58.0 KB)

User Avatar
Member
8595 posts
Joined: 7月 2007
Online
either of those method could work, the idea is to find only closest point from other curves and move only if the @primnum of found curve is smaller (or larger) than current point's curve, so that only one is moved given the mutual match

however since you really want closest distance to the curve, the best and easiest metchod would probably be using
xyzdist()

and again only find the nearest curve other than current and move points only if that curve's @primnum is smaller (or larger) than current @primnum

float radius = chf("radius");
float height = chf("height");
int pid; vector puv;
float dist = xyzdist(0, "!" + itoa(@primnum), @P, pid, puv, radius);
if (pid > @primnum) {
    @P.y += height * chramp("falloff", fit(dist, 0, radius, 0, 1));
}

Attachments:
OverlappingLines_fix.hip (134.0 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
76 posts
Joined: 2月 2017
Offline
Hi Tamte,

your help is great as always! I studied the fixed hip and have a question:
I don't quite get what is the “!” doing it the xyzdist function?

Many Thanks
Francesco
User Avatar
Member
8595 posts
Joined: 7月 2007
Online
ProceduralFrankie
I don't quite get what is the “!” doing it the xyzdist function?

! means not in the group fields

used xyzdist function is of this form:
float  xyzdist(<geometry>geometry, string primgroup, vector origin, int &prim, vector &uv, float maxdist)

so you can see that “!” is in the primgroup argument
@primnum for each point will return the prim number that that point belongs to
so if you resolve the whole "!" + itoa(@primnum)you will get

!0 for all points of prim(curve) 0
!1 for all points of prim(curve) 1


in other words you are telling xyzdist() function to find closest distance to all the curves that are not the curve that the current point belongs to
Edited by tamte - 2018年12月23日 12:13:29
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
76 posts
Joined: 2月 2017
Offline
I got it!I use it quite often for group selections and alike, but never saw it used in function.

I have few more doubts i would like to ask your help for, if you don't mind.

Firstly, after animating the curves with a carve, i noticed that sometimes is not the curve that is reaching the other that has “already passed” to go over it(which is what i would expect), but the other way around.

Secondly, what if a third line happens to be intersecting in a point where two are already overlapped?How could that be offset to be on top of the previous two?

Thank you
Francesco
Edited by ProceduralFrankie - 2018年12月23日 13:16:45

Attachments:
OverlappingLines_animated.hip (104.5 KB)

  • Quick Links