Results 1 to 8 of 8

Thread: Map 3D to 2D

  1. #1
    Junior Member Newbie
    Join Date
    May 2008
    Posts
    14

    Map 3D to 2D

    Dear all,

    I have an issue. Please help me if you know about it. I would like to build polygons in 2D. the polygons will contain the part of chart that we can see. for example in the image bellow I need to build four polygons correspond to four areas that i marked in red




  2. #2
    Junior Member Newbie
    Join Date
    Nov 2001
    Location
    Swansea, UK
    Posts
    13

    Re: Map 3D to 2D

    so what exactly is your issue? What have you done so far?

  3. #3
    Junior Member Newbie
    Join Date
    May 2008
    Posts
    14

    Re: Map 3D to 2D

    my Issue is how build those polygon from the part of 3D that we can see

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    990

    Re: Map 3D to 2D

    If I understand you correctly, you'll probably need some kind of tesselator.

  5. #5
    Member Newbie
    Join Date
    Apr 2008
    Location
    Germany
    Posts
    38

    Re: Map 3D to 2D

    Computing those polygons can be broken down in a few steps:

    1. Compute the outline of an object. Your objects - at least in your examples - are boxes. A box is convex, so computing its outline comes down to:
    i. transform all vertices ( to screen coordinates
    ii. compute frontfacing/backfacing property of all faces (6). this can be done by either applying the winding rule to all vertice of each face, or by the sign of the z-component of the eye-space face normal.
    iii. each edge (12) between two faces with different front-/backfacing property is part of the outline.

    2. Solving overlapping object polygons. The outlines for the individual boxes will most likely overlap (by their neighbors in the first example and by the coordinate axis in both examples).
    In order to correctly remove overlapping areas, you need depth information (which polygon is in front). Your examples imply two helpful properties: 1. the boxes don't intersect and 2. the boxes are separated by a single axis.
    So you can do something like transforming the x-axis (of your chart) to eye-space, so the sign of it's z-component tells you, whether your boxes are sorted ascending or descending according to their position on the charts x-axis.
    All that is left is computing pairwise the overlapping area of the box-outlines, and remove the overlapping area from the not-in-front outline.

    What i have left out so far is the computation of the outline of the coordinate system, which can occlude the boxes as well (should be straight forward), and possibly clipping computed polygons to the viewport.

    I'm curious, what do you need those polygons for ?

  6. #6
    Junior Member Newbie
    Join Date
    May 2008
    Posts
    14

    Re: Map 3D to 2D

    Thanks for your help. I need those polygons for supporting area mapping on web

  7. #7
    Member Newbie
    Join Date
    Apr 2008
    Location
    Germany
    Posts
    38

    Re: Map 3D to 2D

    There is another constraint i overlooked at first: the decision which polygon is in front is only determinable by the charts x-axis, if you use a parallel projection matrix.
    A perspective projection, looking perpendicular at one box, can lead to this box overlapping its neighbors on both sides (if the eye point is close enough and/or the field-of-view angle is wide enough), and will cause the boxes to its left to have the opposing overlapping order (ascending vs. descending) than those to its right side.

    Two additional constraints might help to solve even this situation: 1. your boxes don't intersect and 2. the front sides of all boxes lie in one plane.
    As long as your viewing direction is a the front and from above (first example) all occlusions will be the front or top side of one box in front of the side (left/right) of a neighboring box.
    So if you compute an additional flag for each outline segment, whether it's a front/top side edge, you can tell by those flags which polygon segment lies in front for every intersection.

    If viewed from below (second example), this changes to front or bottom side of one box in front of a neighboring boxes side, but the bottom side will most likely be occluded by your coordinate system.

    This is getting increasingly complicated, so simpler ideas are welcome

  8. #8
    Junior Member Newbie
    Join Date
    May 2008
    Posts
    14

    Re: Map 3D to 2D

    I did this issues according to your suggestion and it works well. now I am working for removing the overlap that is made by walls from those polygons. Please tell me if you know a good algorithm for excluding a polygon from a polygon. Thank you very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean