Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
3D Terrain
#7
(01-09-2023, 03:24 PM)MasterGy Wrote: I rewrote it to universal. in this example, the DEEP array records the height values. The height value can be easily read.

1 square grid = 2 triangles. He counts with the one that falls into a triangle.


Code: (Select All)
Function exact_deep (x, y)
    x1 = Int(x): x2 = x1 + 1: aposx = (x - x1)
    y1 = Int(y): y2 = y1 + 1: aposy = (y - y1)
    p1 = deep(x2, y1)
    p2 = deep(x1, y2)
    If aposx * aposx + aposy * aposy < (1 - aposx) * (1 - aposx) + (1 - aposy) * (1 - aposy) Then
        p0 = deep(x1, y1)
        q = p0 + aposx * (p1 - p0) + aposy * (p2 - p0)
    Else
        p3 = deep(x2, y2)
        q = p3 + (1 - aposy) * (p1 - p3) + (1 - aposx) * (p2 - p3)
    End If
    exact_deep = q
End Function

Thank you!   I'll try to make this work.   Cheers!
Reply


Messages In This Thread
3D Terrain - by james2464 - 01-08-2023, 09:24 PM
RE: 3D Terrain - by mnrvovrfc - 01-09-2023, 08:29 AM
RE: 3D Terrain - by james2464 - 01-09-2023, 05:13 PM
RE: 3D Terrain - by OldMoses - 01-09-2023, 12:12 PM
RE: 3D Terrain - by james2464 - 01-09-2023, 05:26 PM
RE: 3D Terrain - by OldMoses - 01-09-2023, 06:53 PM
RE: 3D Terrain - by james2464 - 01-09-2023, 08:17 PM
RE: 3D Terrain - by MasterGy - 01-09-2023, 03:24 PM
RE: 3D Terrain - by james2464 - 01-09-2023, 05:28 PM
RE: 3D Terrain - by MasterGy - 01-09-2023, 06:31 PM
RE: 3D Terrain - by james2464 - 01-09-2023, 06:40 PM
RE: 3D Terrain - by MasterGy - 01-09-2023, 06:56 PM
RE: 3D Terrain - by james2464 - 01-09-2023, 08:20 PM
RE: 3D Terrain - by james2464 - 01-10-2023, 06:30 PM
RE: 3D Terrain - by james2464 - 01-11-2023, 07:50 PM
RE: 3D Terrain - by bplus - 01-11-2023, 08:07 PM
RE: 3D Terrain - by james2464 - 01-11-2023, 08:46 PM
RE: 3D Terrain - by james2464 - 01-11-2023, 09:53 PM
RE: 3D Terrain - by bplus - 01-11-2023, 10:34 PM
RE: 3D Terrain - by james2464 - 01-11-2023, 11:51 PM
RE: 3D Terrain - by james2464 - 01-12-2023, 04:08 AM
RE: 3D Terrain - by bplus - 01-12-2023, 05:33 AM
RE: 3D Terrain - by james2464 - 01-12-2023, 04:34 PM
RE: 3D Terrain - by MasterGy - 01-12-2023, 04:57 PM
RE: 3D Terrain - by james2464 - 01-12-2023, 05:37 PM
RE: 3D Terrain - by OldMoses - 01-13-2023, 12:11 AM



Users browsing this thread: 2 Guest(s)