🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.borland
Article #17

Re: 3d programming

#17
From: James Derrick
Date: Mon, 05 Feb 1996 07:49
33 lines
2099 bytes
In article <4f3od9$2jg@zeus.tcp.co.uk>, agale@agale.tcp.co.uk (Aaron Gale)
wrote:

> Does anyone know how to find the intersection of a line and plane
> in simple x,y and z cartesian coordinates.  I have a model made
> up of facets, each facet being defined by 4 points.  The working
> envelope that this model is in, is then scanned from the bottom
> to the top.  However I can't work out how to calculate the z
> coordinate along the scan line that may intersect with a facet.
> 
> The scanning line is always horizontal and is defined with the
> x and y coordinates remaining the same, with one end of the line
> minus z and the other end positive z. As an example at what point
> does the line whose start point is (54,46,-100) and whose end
> point is (54,46,100) intersect with a plane facet defined by 4
> points in a anti-clockwise direction point 1 (40,20,-70),
> point 2 (40,60,-40), point 3 (120,60,-40) and point 4 (120,20,-70).

You only need 3 points to define a plane.  Using these three points you
can calculate the equation for the plane by simulaneous equations.
ie using the first 3 points the equation using a form of z=mx+ny+b would be:

1.  -70 = 40m + 20n + b
2.  -40 = 40m + 60n + b
3.  -40 = 120m + 60n + b

Solving these gives m=0,n=0.75,b=-85.
If you had a more complicated line you could solve the intersection also
by the same method, however as all x & y values are the same, you can just
substitute the x & y in, which gives you the intersection at (54,46,-50.5)

-- 
James Derrick
Technical Details
Message-ID: <jderrick-0502961551360001@slip037.csc.cuhk.hk>
Path: arc1-ca.pugleaf.net!slip037.csc.cuhk.hk!user
References: <4f3od9$2jg@zeus.tcp.co.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!slip037.csc.cuhk.hk!user
From: jderrick@cuhk.edu.hk (James Derrick)
Newsgroups: comp.lang.pascal.borland,comp.lang.pascal.mac,comp.lang.pascal.ansi-iso,comp.lang.pascal.misc,comp.sys.amiga.programmer,comp.graphics.algorithms,comp.os.ms-windows.programmer.graphics,comp.sys.amiga.graphics
Subject: Re: 3d programming
Date: 5 Feb 1996 07:49:47 GMT
Organization: The Chinese University of Hong Kong
Message-ID: <jderrick-0502961551360001@slip037.csc.cuhk.hk>
References: <4f3od9$2jg@zeus.tcp.co.uk>
NNTP-Posting-Host: @slip037.csc.cuhk.hk