「ぎょーむ日誌」目次に戻る | KuboWeb top に戻る | twilog | atom

ぎょーむ日誌 2001-08-20

苦情・お叱りは, たいへんお手数かけて恐縮ですが, 久保 (kubo@ees.hokudai.ac.jp) までお知らせください.

2001 年 08 月 20 日 (月)

        #include "matpack.h"
        int main (void) 
        {
                Scene scene;
                ...
                scene.Transform(...)
                ...
                scene.AddLight( Vector3D(-0.5,-4,0.5),  white, 1);
                ...
                Vector3D camera_position( distance, 1.2*distance, 1.4*distance), 
                         look_direction (-distance,-1.2*distance,-1.4*distance);
                scene.Look(camera_position, look_direction, FieldOfView(45), 0);
                ...
                MpImage image(size,size);
                scene.Open(image);
                ...
                scene.Show();
                ...
        }
                image.WritePngFile("isosurf-demo3.png");
Matpack/demos/Graphics/isosurf-demo3
	...        // Preparation to generate 3x3 inverse matrix
        double  x0( p0.X() ), y0( p0.Y() ), z0( p0.Z() );
        double  x1( p1.X() ), y1( p1.Y() ), z1( p1.Z() );
        double  x2( p2.X() ), y2( p2.Y() ), z2( p2.Z() );
        double  xy01_10( x0 * y1 - x1 * y0 );
        double  xy12_21( x1 * y2 - x2 * y1 );
        double  xy20_02( x2 * y0 - x0 * y2 );
        double  yz01_10( y0 * z1 - y1 * z0 );
        double  yz12_21( y1 * z2 - y2 * z1 );
        double  yz20_02( y2 * z0 - y0 * z2 );
        double  zx01_10( z0 * x1 - z1 * x0 );
        double  zx12_21( z1 * x2 - z2 * x1 );
        double  zx20_02( z2 * x0 - z0 * x2 );
        // Determinant
        double  det( x0 * yz12_21 + x1 * yz20_02 + x2 * yz01_10 );
	...
        // Vector composition
        Xyz     gaze_vector( gaze->NormalizedDirection() );
        double  gx( gaze_vector.X() );
        double  gy( gaze_vector.Y() );
        double  gz( gaze_vector.Z() );
        double  a0( yz12_21 * gx + zx12_21 * gy + xy12_21 * gz );
        double  a1( yz20_02 * gx + zx20_02 * gy + xy20_02 * gz );
        double  a2( yz01_10 * gx + zx01_10 * gy + xy01_10 * gz );
	...
VitTriangle [VitTriangle]
三角形の障害物 (緑). 赤線はそれにぶつかってる「視線」. 黄線はわきをすりぬけたもの. これは POV-Ray による作図. (左図クリックすると拡大)

KuboLog | KuboWeb