Towards A More General 4D Object Viewer

Discuss interdimensional programming, Java applets and so forth.

Towards A More General 4D Object Viewer

Postby pat » Thu Sep 21, 2006 9:12 pm

I'm pondering how best to let one input arbitrary 4D objects into an applet. I'm thinking this for a format:

Assuming that I didn't munge a facet or face somewhere, this is a cube...
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Object4D SYSTEM "Obj4D.dtd">
<Object4D>
    <Points scale="0.75">
        <Point> -1 -1 -1 -1 </Point>
        <Point> -1 -1 -1  1 </Point>
        <Point> -1 -1  1 -1 </Point>
        <Point> -1 -1  1  1 </Point>
        <Point> -1  1 -1 -1 </Point>
        <Point> -1  1 -1  1 </Point>
        <Point> -1  1  1 -1 </Point>
        <Point> -1  1  1  1 </Point>
        <Point>  1 -1 -1 -1 </Point>
        <Point>  1 -1 -1  1 </Point>
        <Point>  1 -1  1 -1 </Point>
        <Point>  1 -1  1  1 </Point>
        <Point>  1  1 -1 -1 </Point>
        <Point>  1  1 -1  1 </Point>
        <Point>  1  1  1 -1 </Point>
        <Point>  1  1  1  1 </Point>
    </Points>

    <Facets>
        <Facet orientation="0 1 4 2" name="-w" color="1.0 1.0 1.0 1.0">
            <Face> 0 1 3 2 </Face>
            <Face> 4 6 7 5 </Face>
            <Face> 0 4 5 1 </Face>
            <Face> 2 3 7 6 </Face>
            <Face> 1 5 7 3 </Face>
            <Face> 0 2 6 4 </Face>
        </Facet>
        <Facet orientation="8 9 10 12" name="+w" color="1.0 1.0 1.0 1.0">
            <Face>  8 10 11  9 </Face>
            <Face> 12 13 15 14 </Face>
            <Face>  8  9 13 12 </Face>
            <Face> 10 14 15 11 </Face>
            <Face>  9 11 15 13 </Face>
            <Face>  8 12 14 10 </Face>
        </Facet>

        <Facet orientation="0 1 2 8" name="-z" color="1.0 1.0 1.0 1.0">
            <Face>  0  2  3  1 </Face>
            <Face>  8  9 11 10 </Face>
            <Face>  0  1  9  8 </Face>
            <Face>  2 10 11  3 </Face>
            <Face>  0  8 10  2 </Face>
            <Face>  1  3 11  9 </Face>
        </Facet>
        <Facet orientation="12 13 14 4" name="+z" color="1.0 1.0 1.0 1.0">
            <Face> 12 14 15 13 </Face>
            <Face>  4  5  7  6 </Face>
            <Face>  4 12 13  5 </Face>
            <Face>  6  7 15 14 </Face>
            <Face>  4  6 14 12 </Face>
            <Face>  5  7 15 13 </Face>
        </Facet>

        <Facet orientation="0 1 8 4" name="-y" color="1.0 1.0 1.0 1.0">
            <Face>  0  8  9  1 </Face>
            <Face>  4  5 13 12 </Face>
            <Face>  0  1  5  4 </Face>
            <Face>  8 12 13  9 </Face>
            <Face>  0  4 12  8 </Face>
            <Face>  1  9 13  5 </Face>
        </Facet>
        <Facet orientation="10 11 2 14" name="+y" color="1.0 1.0 1.0 1.0">
            <Face>  2  3 11 10 </Face>
            <Face>  6 14 15  7 </Face>
            <Face> 10 11 15 14 </Face>
            <Face>  2  6  7  3 </Face>
            <Face>  2 10 14  6 </Face>
            <Face>  3  7 15 11 </Face>
        </Facet>

        <Facet orientation="0 8 2 4" name="-x" color="1.0 1.0 1.0 1.0">
            <Face>  0  2 10  8 </Face>
            <Face>  4 12 14  6 </Face>
            <Face>  0  8 12  4 </Face>
            <Face>  2  6 14 10 </Face>
            <Face>  0  4  6  2 </Face>
            <Face>  8 10 14 12 </Face>
        </Facet>
        <Facet orientation="9 1 2 13" name="+x" color="1.0 1.0 1.0 1.0">
            <Face>  1  9 11  3 </Face>
            <Face>  5  7 15 13 </Face>
            <Face>  1  5 13  9 </Face>
            <Face>  3 11 15  7 </Face>
            <Face>  9 13 15 11 </Face>
            <Face>  1  3  7  5 </Face>
        </Facet>
    </Facets>
</Object4D>


The numbers in "Face" are (0-based) indexes into the list of vertexes.

The numbers in the orientation are also indexes into the list of vertexes. The first number in the list iindicates which vertex is being used as a reference point for the orientation. The other indices reference directions from the reference point. So, for example, a facet with orientation 0 1 4 2 has these three axises defining its space: (v1 - v0), (v4 - v0), and (v2 - v0). This is used to calculate the normal of the three-space in which the facet lies. The normal n will be the unit vector, perpendicular to (v1-v0), (v4-v0), and (v2-v0), which makes the determinant of the matrix [ (v1-v0) (v4-v0) (v2-v0) n ] positive. The order matters. If you transpose two of the last three numbers, the normal of the space would flip.

The orientation of the facet will be used for "back facet culling". If you don't specify an orientation, one will be calculated to point away from the origin. If you don't care about the orientation, you will have the option of turning off "back facet culling".

The order of the vertex indices within a face matters. They will be used to calculate the face normal for "back face culling".

The numbers in the color are, respectively: red, green, blue, and opacity.

Is this too complicated? Does it leave out any important aspect of a faceted object?

I may have a special case for wireframe where you just do something like this:
Code: Select all
npoints
x1 y1 z1 w1
x2 y2 z2 w2
...
xn yn zn wn

medges
a1 b1
a2 b2
...
am bm

Where the ai and bi are indexes of points.... or should I just go...
Code: Select all
x11 y11 z11 w11   x12 y12 z12 w12
x21 y21 z21 w21   x22 y22 z22 w22
...
xn1 yn1 zn1 wn1   xn2 yn2 zn2 wn2


And, eventually a "convex hull" thing where you just dump in a list of points.
Last edited by pat on Tue Sep 26, 2006 7:15 pm, edited 1 time in total.
pat
Tetronian
 
Posts: 563
Joined: Tue Dec 02, 2003 5:30 pm
Location: Minneapolis, MN

Postby pat » Tue Sep 26, 2006 7:35 pm

Desired features:
  • Load:
    • Arbitrary points and colored facets (above format?)
    • Arbitrary points and (colored?) edges
    • Convex hull of arbitrary points
    • Actual curved lines for rotatopes instead of mesh approximations
  • Stereo-pair views:
    • Parallel or Cross-Eyed
    • Perspective, Orthographic, or Stereographic
    • Scaling
    • Panning
    • Rotating
    • Auto-rotation
  • Depth-cuing:
    • Color cues
    • Brightness cues
    • Line thickness
    • Vertex size
    • Overlapping
  • Culling:
    • Back-facet culling (for faceted objects or convex hulls)
    • Back-face culling (for faceted objects or convex hulls)
    • Hidden facet removal (for convex objects, the back-facet culling covers it)


The italicized things are "not in the immediate future" sorts of things.
pat
Tetronian
 
Posts: 563
Joined: Tue Dec 02, 2003 5:30 pm
Location: Minneapolis, MN


Return to Programming

Who is online

Users browsing this forum: No registered users and 10 guests