From mboxrd@z Thu Jan 1 00:00:00 1970 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <217E2E30-ED7F-40A8-9C11-7D0689255996@mac.com> References: <217E2E30-ED7F-40A8-9C11-7D0689255996@mac.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <6C91D0B5-0452-402A-8BE2-35F564C5E755@telus.net> Content-Transfer-Encoding: 7bit From: Paul Lalonde Subject: Re: [9fans] Attempt at making 3D graphics library Date: Fri, 23 Nov 2007 22:57:22 -0800 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Topicbox-Message-UUID: 09cf0faa-ead3-11e9-9d60-3106f5b1d025 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 It's hard to tell what might be wrong with your transformation if you don't also show the transformation matrix you are using, including the camera parameters. What you probably want is for your transform to go from some world space coordinates (your 5,5,5) to screen space. It's also not clear if you are expecting device coordinates (0..1023, 0..767) or normalized coordinates (0..1, 0..1). Your resulting coordinates aren't too far off for some camera vaguely pointing at the origin and a device coordinate transformation matrix. Paul On 23-Nov-07, at 7:43 PM, Pietro Gagliardi wrote: > Hello. I realized that that last /usr/glenda/bin/rc/pull focused on > a rewrite to the system libraries. I decided to start writing a > library to convert 3D coordinates to 2D coordinates based on the > data at http://www.shade.ca/getarticle.asp?i=11. You can find it > at /n/sources/contrib/pietro/3d.bundle. It contains: 3d.h (the > header), 3d.c (the library itself), and 3dtest.c (a test program). > The test program doesn't seem to work right. It looks like the 2D > coordinates are way off the charts - the x coordinates are between > 500 and 600 for xyz=(5,5,5)! I wonder... This makes the line a stub > in the center of a 1024x768 screen. Plus, the threadmain crashes on > threadexitsall. What's going on? > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iD8DBQFHR8tTpJeHo/Fbu1wRAsrrAKC6Bmdz31+VYVSEGWRiGRkD133Y7QCgmCzS 56gVAizyJ4ndkHWUIixuJ1k= =PMob -----END PGP SIGNATURE-----