Compeller

Development area for FreeAllegiance's Community Core.
KGJV
Posts: 1474
Joined: Tue Jul 01, 2003 7:00 am
Location: Transilvania

Post by KGJV »

Ramaglor wrote:QUOTE (Ramaglor @ Sep 24 2009, 10:44 PM) Maximum dimension would be the appropriate value? (it gives x-span, y-span, z-span)
In the code, radius is computed as:

max (distance to center (0,0,0) of all vertices in the mesh)

so no it's not equal to length of (x-span, y-span, z-span) unless there is a vertex at (x-span, y-span, z-span) position.
Image
Compellor
Posts: 994
Joined: Fri Jul 06, 2007 12:56 am
Location: Columbus, OH

Post by Compellor »

So if I have my farthest vertex at (3,2,1) should I be getting a radius of 3 or 3.74? Because now that I think about it, the cube-based shape I was testing had its farthest vertex there, but the CVH had its radius listed as 3. Changing that to 3.74 with a text editor made the cvh hull-conforming. What this means is that AMT export is miscalculating radius values. I'll have to take a look at the artwork tools to see what if any problem they have with such calculations, but it's time for bed.

Actually, I guess it's only a miscalculation if you're making a station, since stations have a radius and ships have a length. I think.

The good news is that we can calculate the correct value ourselves with fairly simple math.
Last edited by Compellor on Fri Sep 25, 2009 2:46 am, edited 1 time in total.
Any job worth doing with a laser is worth doing with many, many lasers. -Khrima
Beyond a shadow of a doubt if you don't watch them like a hawk they will stack their collective balls off - MrChaos on Alleg players
Andon
Posts: 5453
Joined: Sun Jun 03, 2007 8:29 pm
Location: Maryland, USA
Contact:

Post by Andon »

Indeed, finding the farthest vertex isn't that difficult. And since bases use a radius and ships use length, then it shouldn't be too much of an issue.
Image
ImageImage
madpeople
Posts: 4787
Joined: Tue Dec 16, 2003 8:00 am
Location: England

Post by madpeople »

oh right, I see what's wrong now, yes, my previous suggestion was silly, a tool that reads the .cvh file, calculates the max distance, and then replaces the original radius with it's calculated value would be useful then perhaps?

where does one find information on the .cvh file format?

A slightly edited example cap03.cvh (a large number of lines removed)

Code: Select all

      3.42824084      1.35787840      1.68161230      3.89524558      1.13622285
1
   71  414        0.00000000       -0.01126250       -0.02403950
       -0.09540500       -0.53637400       -3.34234500    5
   60    1    3   39   38
        0.00000000       -0.53637400       -3.38602100    8
   58   60   62    0    2   36   37   38
        0.09540500       -0.53637400       -3.34234500    5
    1   62   33   40   36
       -0.19081000       -0.53637400       -3.22044000    3
   60    0   39

<snip>

wepemt
       -0.0003259999       -1.2049859762       -0.3861339092
        0.0000000000        1.0000000000       -0.0000005960
turwepemt1
        0.0071899998        0.6275560260       -0.6033889651
        0.0000000000       -0.9941724539        0.1078012586
cockpt
        0.0000000000        0.7623199821        1.4784229994
        0.0000000000        0.0000000000        1.0000000000
missemt
        0.7883459926       -0.0049510002        0.4766269922
        0.0000000000        1.0000000000       -0.0000006401
From inspection and this thread I think that:

Code: Select all

      [dist to max vert from origin]      [unknown 1]      [unknown 2]      [unknown 3]      [unknown 4]
[1 seems to always be "1" in all .cvhs I've looked at]
   [number of verts in cvh]  [number of edges?]        [unknown 5X]       [unknown 5Y]       [unknown 5Z]
       -0.09540500       -0.53637400       -3.34234500    5 // vert X Y Z location followed by a number indicating how many other verts it is connected to
   60    1    3   39   38 // the vert IDs that this vert is conected to, numbering is implicit from order in cvh file, above vert is #1, one below is #2
        0.00000000       -0.53637400       -3.38602100    8
   58   60   62    0    2   36   37   38
        0.09540500       -0.53637400       -3.34234500    5
    1   62   33   40   36
       -0.19081000       -0.53637400       -3.22044000    3
   60    0   39

<snip>

wepemt //obvious what this is
       -0.0003259999       -1.2049859762       -0.3861339092 //origin / from X Y Z coord
        0.0000000000        1.0000000000       -0.0000005960 //destination / to X Y Z coord
turwepemt1
        0.0071899998        0.6275560260       -0.6033889651
        0.0000000000       -0.9941724539        0.1078012586
cockpt
        0.0000000000        0.7623199821        1.4784229994
        0.0000000000        0.0000000000        1.0000000000
missemt
        0.7883459926       -0.0049510002        0.4766269922
        0.0000000000        1.0000000000       -0.0000006401
pkk
Posts: 5419
Joined: Tue Jul 01, 2003 7:00 am
Location: Germany, Munich

Post by pkk »

My old cvh research:

Code: Select all

     18.56708513     20.59096474     17.63295038      8.29428640      1.10900363
     ^ radius of object
                     ^ ellipse equation x
                                     ^ ellipse equation y
                                                      ^ ellipse equation z
                                                                      ^ ellipse radius multiplier
    9
    ^ Number of hulls within this object
   27  150        0.72494650        0.72697600        0.77916900
   ^ number of points within this hull
       ^ number of adjacents within this hull
                  ^ x/y/z coordinate center of this hull
       14.07607700       -5.19403600       -4.68549200    4
       ^ x/y/z coordinate of one point of this hull
                                                          ^ number of adjacents of this point
    2    1   12   10
    ^ adjacents of point to other points (pointIDs?) within this hull

...

turwepemt2
^ these are framechilds: weaponmounts, turretmounts, missilemounts, launch mounts, (cap)garage end points (A, B, C, D are end points of garage, while E is the direction where the garage is open)
        9.7338323593      -14.0620555878       -0.1120543256
        ^ x/y/z of position (D3DVECTOR)
        0.0000000000       -1.0000000000       -0.0000005960
        ^ x/y/z of direction (D3DVECTOR)

...
The Escapist (Justin Emerson) @ Dec 21 2010, 02:33 PM:
The history of open-source Allegiance is paved with the bodies of dead code branches, forum flame wars, and personal vendettas. But a community remains because people still love the game.
KGJV
Posts: 1474
Joined: Tue Jul 01, 2003 7:00 am
Location: Transilvania

Post by KGJV »

started a wiki page on CVH format here: http://www.freeallegiance.org/FAW/index.php/CVH

feel free to enhance/pretty it.
Image
KGJV
Posts: 1474
Joined: Tue Jul 01, 2003 7:00 am
Location: Transilvania

Post by KGJV »

I've updated MDLView so that it computes the radius like the engine does:

http://allegice.googlecode.com/files/MDLView11.zip
Image
raingriffin
Posts: 145
Joined: Wed Jul 01, 2009 12:23 pm
Location: Italy

Post by raingriffin »

thanks for the good work mate. every support helps in alleg's proper
-sing- Just always look on the bright side of life -whistle, bow to monty python's Life of Brian-

Image
Raven_42
Posts: 635
Joined: Sun Feb 18, 2007 3:22 pm
Location: Scotland

Post by Raven_42 »

What are you fools doing?! Don't fix those doors, its HTT defense ffs! :doh:
Last edited by Raven_42 on Wed Sep 30, 2009 2:13 pm, edited 1 time in total.

Code: Select all

[img]http://img97.imageshack.us/img97/4351/babelfish.png[/img]
Post Reply