Drawing a Topographical Map

前端 未结 9 2309
遥遥无期
遥遥无期 2020-12-22 21:31

I\'ve been working on a visualization project for 2-dimensional continuous data. It\'s the kind of thing you could use to study elevation data or temperature patterns on a 2

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-22 22:05

    The gradient is a mathematical operator that may help you.

    If you can turn your interpolation into a differentiable function, the gradient of the height will always point in the direction of steepest ascent. All curves of equal height are perpendicular to the gradient of height evaluated at that point.

    Your idea about starting from the highest point is sensible, but might miss features if there is more than one local maximum.

    I'd suggest

    1. pick height values at which you will draw lines
    2. create a bunch of points on a fine, regularly spaced grid, then walk each point in small steps in the gradient direction towards the nearest height at which you want to draw a line
    3. create curves by stepping each point perpendicular to the gradient; eliminate excess points by killing a point when another curve comes too close to it-- but to avoid destroying the center of hourglass like figures, you might need to check the angle between the oriented vector perpendicular to the gradient for both of the points. (When I say oriented, I mean make sure that the angle between the gradient and the perpendicular value you calculate is always 90 degrees in the same direction.)

提交回复
热议问题