Brief: how can I add m
rows to my m X n
data frame, where each new row is inserted after each existing row? I will essentially copy the existing row, but make a change to one variable.
More detail: in reference to another question, I think I can do what I want with rgl's segments3d function. I have a set of x,y,z points, but these are just one end point of a set of line segments. The other end point is so many metres away in the Z dimension, given as a fourth variable: X,Y,Z,Z_Length; in my terminology it's easting,northing,elevation,length.
According to the rgl docs, "Points are taken in pairs by segments3d". So, I think I need to modify my data frame to have extra entries every second line with an altered Z variable (by subtracting Z_Length from Z). Visually, it needs to go from this:
+-------+---------+----------+-----------+---------+
| Label | easting | northing | elevation | length |
+-------+---------+----------+-----------+---------+
| 47063 | 554952 | 5804714 | 32.68 | 619.25 |
| 47311 | 492126 | 5730703 | 10.40 | 1773.00 |
+-------+---------+----------+-----------+---------+
to this:
+-------+---------+----------+-----------+---------+
| Label | easting | northing | elevation | length |
+-------+---------+----------+-----------+---------+
| 47063 | 554952 | 5804714 | 32.68 | 619.25 |
| 47063 | 554952 | 5804714 | -586.57 | 619.25 |
| 47311 | 492126 | 5730703 | 10.40 | 1773.00 |
| 47311 | 492126 | 5730703 | -1762.26 | 1773.00 |
+-------+---------+----------+-----------+---------+
A data sample at the linked question is available.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…