Tips on finding the volume of water in a 3d chess board

前端 未结 5 1657
栀梦
栀梦 2021-02-10 07:48

So I have an assignment where I have to recreate a 3d chessboard that is a RxC grid of squares each being a different height. If the chessboard is water tight, and someone pours

5条回答
  •  悲&欢浪女
    2021-02-10 08:19

    This is going to take more than simply calculating volume.

    According to the examples you posted, you have test for containment first, then worry about the volume of the container.

    I suggest determining whether or not there is a closed polygon in the board.
    If the polygon is closed, determine its area.
    The height used for volume calculation will be the minimum height of all the bounding walls.
    Finally, the volume will be the minimal height multiplied by the area of the polygon.

    Research on the web for algorithms on determining a closed polygon based on a vector of vertices or line segments.

提交回复
热议问题