# GH all perp vector facing inwards

I need help, I’m stuck for a moment.
I have to create vectors perpendicular to all curves but oriented towards the surface. Can anyone help here?
I could offset mid of the curve (both sides), find an inclusion point and then create a vector but it seems as a dumb workaround.

I found another way by offesting surface outline inside, pulling middle points towards it and creating perp. vector. It works but maybe there is more clever way of doing it. (?)

Are you after offsets the “analytic” way ? Or you just want inside/outside Points that are at distance D from a given segment Point (at some t) and thus define Vectors as well. For instance any such Point should belong to the blue poly.

But the general case of this indeed requires inclusion (and DotProduct) tests. For instance and for a “big” D the valid blue portions are way fewer than the ones in the first pic.

Or in fact you want to define all blue segments that could yield such Points?

I’m only interested in getting perpendicular vector of selected segments in most elegant way. Distance doesn’t matter. If they were joined it would have been easy.
PS Native components only. I am preparing HUGE def for 3rd party users who are not very much familiar with GH or not familiar at all.

That’s exactly what I have desribed in second thread That’s what I thought. Then it works well. Pozdrawiam There can be the case where it wouldn’t.
Imagine two edges being closer than offset distance. Offset will fail. It would need to have input of the length of shortest segment divided by 2 minus fraction of it. Theoretically.
Pozdrawiam. P

Then the offset distance need to be 10 times lesser than the most smaller segment or at least slightly more than the tolerance of your Rhino file itself. I think that it will work this way. You can untize vector in vector component later.

Vector.gh (7.3 KB)
In this case the offset is 0.001 which is tolerence of the rhino file. You cannot draw segment smaller than that and so there will no offset lesser than that. And hence it will always work.

This can be made more elegant, but there you have the idea.

Another option is to take a midpoint, direction to each line, cross product with line direction, if the dot with Z axis is negative, reverse the line direction.

The same thing can be done in hundred ways. But I don’t know what is going on here. The vectors of equal magnitude is needed to be anchored at edges of a surface and towards direction of a surface. You have vectors of different magnitudes following what? Did you understood the problem correctly?

This is more valid way. Exploding and reparmetrizing input curves can give vectors at equal intervals at each segment. I cull end vectors to avoid overlap at vertex in my case. Vector1.gh (7.3 KB)

Joseph, I don’t get this solution.
What if your curve is exploded or discontinued and vector not being all clockwise or counterclockwise but at random?

Same comment as to Joseph. By exploding polyline you have all segment going the same direction which is not the case here.

Generally surface edges follow same direction and if it are joined as input, it follows same direction.

Surface is just an excuse here to better describe the problem.

FAIL! The way to better describe the problem is post a file with geometry!

The solution I posted works only for curves in the XY plane. There are similar ways of dealing with other curves but without your test geometry, why bother?

I am working for solution in any given case, any scenario thus infinity of them.
Here is the example perp vector test.3dm (55.2 KB)

And yet the examples you provide are all planar surfaces in the World XY plane. Hardly a test of “any scenario”.