To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 5679
5678  |  5680
Subject: 
Re: VB - parts and transformation matrices, Z-ordering, optional lines, bow-tied quads - help!
Newsgroups: 
lugnet.cad
Date: 
Tue, 27 Mar 2001 11:42:10 GMT
Viewed: 
1017 times
  
Daniel Crichton wrote:
> I've been messing with some VB code to read DAT files and draw them on the
> screen, and have been surprised at how quickly I managed to pull it together
> (esp. after spending some time poring over the LDraw FAQ trying to work out
> the transformation matrix equations before realising that they were slightly
> wrong, the x in the 'a*x' etc is not the same as the x in '+ x' at the end
> of the calc!) but I have 2 problems.

Another Viewer comming up. <:)

> 1). If I load up 3626bp01.dat everything looks fine except the eyes, the
> disc and cut-out primitives are placed in the middle of the head and
> slightly rotated. I've toyed with the idea that the matrix I'm using is
> wrong but it works for every other subpart and primitive, so I'm a bit
> stuck. And it happens with all heads with eyes, and makes a complete mess of
> torsos with patterns. I'll post some outputs to Brickshelf if anyone is
> interested in helping and needs to see what is happening.

You are probably Pos-Multiplying the modeling Matrix, instead of
Pre-Multiplying.
I had that problem too !

> 2). Z-ordering. At the moment I'm just drawing the polygons in the order
> they appear in the DAT files, but obviously I need to handle Z-ordering so
> that the parts are rendered correctly. Any idea on where I might find some
> sample VB code that could be applied to DAT files easily, or a pointer to
> algorithms I could write in VB to handle this?

You could you the Painters Algorithm, but that is going to be slow, but
prevents you from using a Z-buffer.

A Simple explanation: Sort by polygon depth, then draw each one in
fardest to nearest order.
Hope I managed to right those last words correctly.

> 3). Any sample VB code on handling optional lines? At the moment I just have
> an option to turn them on and off, but if they're on I'm just drawing all
> the lines indicated by the points which makes a bit of a mess, and I'm
> having trouble sorting out the equations needed to work out which lines to
> draw (it's been over 10 years since I left school and my memory's going).

Using the Painter Algo, you just draw the Lines, which belong to each
poly, exactly after drawing the poly.

> 4). Any algorithms for sorting out bow-tied quads? I've found a few parts
> that don't render well at all, and it appears that the points are not stored
> in a clockwise/anti-clockwise direction, so my filled polygons come out as 2
> triangles meeting at vertices.

This was already answered on another reply.

See yaa, and Good Luck

Rui Martins



Message has 1 Reply:
  Re: VB - parts and transformation matrices, Z-ordering, optional lines, bow-tied quads - help!
 
(...) Maybe, maybe not - I'm trying to build something that will help me draw complicated patterns on existing parts, such as the Darth Maul pattern (75% done). (...) OK, you've lost me here - I just applied the matrix calculation as-is from the (...) (25 years ago, 27-Mar-01, to lugnet.cad)

Message is in Reply To:
  VB - parts and transformation matrices, Z-ordering, optional lines, bow-tied quads - help!
 
I've been messing with some VB code to read DAT files and draw them on the screen, and have been surprised at how quickly I managed to pull it together (esp. after spending some time poring over the LDraw FAQ trying to work out the transformation (...) (26 years ago, 26-Mar-01, to lugnet.cad)

8 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR