' create surfaces 

sub main

    dim plist as Point3FArray = new Point3FArray()
    dim flist(1) as TriangleFace ' an array of 2 elements
    
    'create a new surface object
    dim surf as surface = new surface

    'create a pointlist and add 4 points

    dim pt as point3F = new Point3F(0,0,0)
    plist.add(pt)

    pt = new point3F(10,0,0)
    plist.add(pt)

    pt = new point3F(5,10,0)
    plist.add(pt)

    pt = new point3F(0,10,0)
    plist.add(pt)
    
    'add the point list to the surface object
    surf.Points = plist
    
    'fit the faces array with the triangle data
    
    ' the first triangle use the point 0 to 2 (index in the point list)
    ' drawn with a rotation in CCW, face is visible

    flist(0).A = 0
    flist(0).B = 1
    flist(0).C = 2    

    ' the second triangle
    ' drawn with a rotation in CW, face is reverted
    flist(1).A = 0
    flist(1).B = 3
    flist(1).C = 2    

    'add the surface list to the surface object
    surf.Faces = flist
    
    'add the surface object to the document
    doc.add(surf)
    

end sub