# RE: [Flightgear-devel] AI carrier

David Culp wrote:
>
>  > 3)  Make the decks solid.
>  > 9)  Make island solid
>
> Here's how I think we can solidify the decks and island.  First we need to
> define some rectangles (2? 3? a variable list?).
>
> http://home.comcast.net/~davidculp2/decks.jpg

Mathias Froelich ahs done some work for areas on the ground, and if I
understand his code correctly (I'll send a copy to you) he uses triangles. I
would favour that solution anyway, because it is easy to divide the deck
into triangles which fit the area exactly, thus avoiding the situation of
the aircraft with at least one leg in mid air.

http://myweb.tiscali.co.uk/vmeazza/FlightGear/deck.jpg

We can get the co-ords quite easily, I think, relative to the model origin
from the .ac file.

>
> Each rectangle is defined in the carrier config file, in carrier body
> coordinates.
>
>   x-offset
>   y-offset
>   angle
>   length
>   width
>   height

We could do it in X,Y,Z world co-ords. That's an easy conversion from the
co-ordinates of the carrier origin, and it deals with any vertical surfaces
we might need.

So:

X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3
.
.
.
as many times as you need

> When the aircraft gets close (say 1 mile, <300 feet) the carrier will
> start
> checking to see if the aircraft position is within any of the reactangles.
> This will require a lot of coordinate transformation, and it would be good
> to
> get the fastest algorithm possible.
>
> ***-> Any ideas here? <-***

How about doing it from the aircraft perspective? That's done already for
scenery.

>
> After all rectangles are processed the highest height value is kept, and
> this
> is then used to override the scenery height using
> globals->get_scenerey()->set_cur_elev(height).
>
> I think if we make the island's rectangle about 5 feet above deck height,
> then
> we'll get a crash if you fly into it.  Come to think of it, we need a
> better
> crash response from the the sim.  Maybe a "crash" dialog would suffice.

If we do triangles this might be implicit
>
> Note that this is just the first phase in completing the deck.  Once we
> have
> it solid then we can do catapult and wire placement, which will require
> even
> more coordinate transformations.
>

Mathias is already well down the road for arrester wires on the ground. The
algorithm is roughly:

Is there is a wire in the triangle?

If yes, then test for the hook catching it (using one of plib's functions:

sgIsectLinesegPlane),

Which checks if a line (the wire) defined as (X1,Y1,Z1), (X2,Y2,Z2)
intersects with a plane. In this case the plane is defined by the co-ords of
the hook on the last and this iteration.

If caught, then tell the FDM

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d