0

I have a set of positions of a curve line which red line of image, Now I have to calculate positions of rest curve lines which green line of image.

I want to combine all lines as polygon for draw which the blue line of image, I can't use line with to do it. Because I need to render color by measure data.

Now I draw blue line with triangles.

How should I calculate perpendicular curve line offset?

image 1 Image of Line Channel Description

Spektre
  • 49,595
  • 11
  • 110
  • 380
Hunk
  • 5
  • 2
  • In fact I tried dx, still incorrect, Maybe I should not use slope of line to render multiple curve line. – Hunk Jun 22 '23 at 16:07
  • all channels data I have to render as curve line. And I need to combine all channel data as one curve line to render on the screen. It like width of line. but I only get one set of positions for channel 1. I tried to calculate perpendicular curve line of channel 1 curve line for other channels, but seems doesn't work well. – Hunk Jun 22 '23 at 16:12
  • Please have another go at explaining what (geometrically) you are trying to do. The description at the moment is incomprehensible, and the linked image is no help. I suspect that there is a language barrier here. – lastchance Jun 22 '23 at 17:20
  • Thank you for support, I close the question, and re-post by clear description – Hunk Jun 22 '23 at 19:11
  • Can you demonstrate what kind of offset you want, with an actual curve, not a line? How is your curve defined, by a list of points? Is there any non-linear interpolation? – HolyBlackCat Jun 22 '23 at 20:00
  • I have a set of offset values of other channels. like below, Yes I have a list of points of base curve line, No I don't have any non-linear interpolation. X_OFFSETS:0.6835 0.5535 0.4235 0.2935 0.1635 0.03350002 -0.09649998 -0.2265 -0.3565 -0.4865 -0.6165 Y_OFFSETS:0.002499998 0.002499998 0.002499998 0.002499998 0.002499998 0.002499998 0.002499998 0.002499998 0.002499998 0.002499998 0.002499998 – Hunk Jun 22 '23 at 20:44
  • In fact, the list of points are gps location, and channels offset values are transmitter and receiver offset of gps device . – Hunk Jun 22 '23 at 20:47
  • Well, your Y_OFFSETS are all the same and the X_OFFSETS are (equi-spaced) along a line. But I'm still completely at a loss to understand what you are trying to do. What exactly do you mean by "curve line" and "perpendicular curve line offset"? Do you have some reference link (preferably in English) to explain this? – lastchance Jun 22 '23 at 21:32
  • I just add another image(Image of Line Channel Description) to describe my question. Every line is channel, I just would like to render this polygon with color mapping. but I only got a list of points of first line, I calculated the points of rest of lines. which you can see on the image, draw with other color. Now my question is other line points is not correct. the correct value is should start at red line. – Hunk Jun 22 '23 at 23:06
  • @Hunk, your description is still too confusing and you are not showing code. What do you mean by "Every line is channel"? When you say "this polygon" what polygon are you referring to? When you say "which you can see on the image" which of the (currently) four images are you referring to? When you say "the correct value is should start at red line" - which red line in which image are you referring to? Your final image (at present) has at least four red lines. If you mean that three of them don't start on the fourth that is true - but we need to see all relevant code. – lastchance Jun 23 '23 at 08:53

1 Answers1

1

so this is locally projected to 2D?

Offsetting a line means you just add offset to its endpoints. The perpendicular shift is computed in 2D very simply. You have line endpoints P0,P1 and want line Q0,Q1 which is parallel to P0,P1 at distance l so:

dp = P1-P0                 // line direction vector
dp /= length(dp)           // make it unit
dq =  vec2( +dp.y, -dp.x ) // rotate by 90 deg in 2D so dq is perpendicular to dp
dq *= l                    // offset is now equal to size l
Q0 = P0 + dq
Q1 = P1 + dq

now if you are doing curves or polygons you have to handle the edges see:

if this is 3D then you have to use cross product to get the dq along with some reference direction (like normal to earth surface)

dq = cross (dp , some_refernce_direction_unit_vector)
dq *= l
Spektre
  • 49,595
  • 11
  • 110
  • 380