To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 3123
3122  |  3124
Subject: 
Object Orientation & DAT files & CLIPPING/WINDING
Newsgroups: 
lugnet.cad.dev
Date: 
Mon, 18 Oct 1999 12:51:59 GMT
Reply-To: 
rui.martins@link%Spamcake%.pt
Viewed: 
544 times
  
There has been a great discussion, about the optimizing with
clipping topic, but it seems IMHO that people are forgetting simplicity
is the best.

Now if you read the subject of this message, maybe you know what I am
talking/writting about.

we must think in an object oriented way.
----------------------------------------

So look at a .DAT file as a representation of an object, which by
"accident" is graphic object.

An object does not show how it works in the inside, it only shows to the
world a specific behaviour, how it is done in the inside does not matter.

So, what we have to do is to define the behaviour for this object, has
seen from the rest of the world.

So I will propose the following behaviour,
as seen from the world (the outside of the .DAT file):
----------------------

Remember
  The .DAT is a closed object, we can't see inside it (just assume).

- A .DAT file is CCW
- A .DAT file is possibly optimized for clipping (not realy relevant)
- A .DAT file is always oriented outwards or upwards as applicable,
  this information is to be used, when you want to INVERT a file.

This was the behaviour, as seen from the rest of the world.
This is what you have to keep in mind when you are referencing other
.DAT files.
For you, the other .DAT files are an external object,
so you are the world relative to them.
    ----------------- remember this song? ;)

Now what is the behaviour inside the object (.DAT)

Everything that is assumed by the rest of the world, must be the default
inside the object.
if inside, the object requires to do things diferently, it will issue meta
commands to accomplish this.

- The following Meta commands scope is local to the file where it is used
0 CLIPPING ON/OFF
0 WINDING ON/OFF
0 INVERT
(this last one is usefull only when referencing other .DAT files)
        (Drawing/Editing program should keep track of matrix inversions)

when revising existent .DAT files or creating a new one, the rule to
follow is: "make it look to the outside as it is expect"

to optimize existent .DAT files, use the following rules besides the
previous one:
- Enable clipping at the head of the file (if not a flat object)
- If a given polygon is CW, then instead of putting a '0 WINDING CW'
  before it, change the definition of the polygon, from 1,2,3 to 3,2,1
  and avoid the meta command (prevents un-necessary state changes)
- if given polygon should never be clipped (i.e. belongs to a flat object)
  disable clipping before these polygons/objects.
  Group all objects of the same kind (clippable/unclippable) to minimize
  clipping state changes. if you put the unclippable polygons/objects at
  the end of the file you will change state only once, from ON (the
  default) to OFF. so only "0 CLIPPING OFF" if needed (seldom used).
- Every polygon should face outwards/upwards as expected, so change them
  accordingly, preventing always the WINDING meta command when possible,
  by following a previous rule.


by following this simple object oriented rules the optimized files can be
as simple as:
0 CLIPPING ON
0 The winding is by default CCW
a lot of CCW polygons (tris/quads)

  Now the INVERT problem:
because the  drawing/editing ldraw compatible program will keep track of
matrix invertions, you will have only to INVERT a reference to a file, if
you don't want to use it in the normal sence.

for example, the 4-4cyli.dat
  Should be used has facing outwards, but you want to model a technic
  hose, with thichness, by defining a sub part like a small cylinder,
  which can be built using a 4-4cyli.dat primitive for the outside an
  another for the inside.
  Since the outside, complies with the expect, you simply use the
  4-4cyli.dat by reference with an eventual resize using the matrix
  But the inside cylinder to be correctly done, with the 4-4cyli.dat,
  must be inverted before using "0 INVERT", so that at the end the
  outward normal point to the correct place

  NOTE:
  if you had a non simetrical object, you will probably need an invert
  matrix (with a negative determinant), besides the INVERT meta command.


Resuming:

When you look to a .DAT file (i.e. when referencing it), it always looks
the same, CCW facing outwards/upwards with possible clipping.

inside the .DAT file, change what is need, so that when drawn the graphic
represents waht was expected by an outside reference.

Be my gests a comment!

Rui

  ---------------------------------------------------------------
| Rui M. S. Martins    Software Engineer    Rui.Martins@Link.pt |
|---------------------------------------------------------------|
| 351 1 3100063                    There is no Place Like $HOME |
  ---------------------------------------------------------------



Message has 2 Replies:
  Re: Object Orientation & DAT files & CLIPPING/WINDING
 
(...) These are all assumptions/specifications which *should* be agreed upon by the L-CAD community, especially parts-authors and rendering program-writers. Agreement is only needed if we want to re-wire the parts library, to encourage (...) (25 years ago, 18-Oct-99, to lugnet.cad.dev)
  Re: Object Orientation & DAT files & CLIPPING/WINDING
 
Rui Martins wrote in message ... (...) Part authors should define the tris/quad the way he finds best, easy and logical - maybe sometimes CW and sometimes CCW. Also when fixing old parts, just insert a lot of WINDING keywords in stead of editing the (...) (25 years ago, 19-Oct-99, to lugnet.cad.dev)

13 Messages in This Thread:




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

Custom Search

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