≡
Products
▼
Support
▼
Company
▼
Forum
Ambiera Forum
Discussions, Help and Support.
Create a new account
,
Search
, or Login:
Create reply in
How to Linepick Clones and animated Meshes??
Posted by:
(you are not logged in)
Enter the missing letter in: "Intern?tional"
(you are not logged in)
Text:
[quote][b]csp-games[/b] wrote: For the records, here's the RIT function in Blitz3D, resembling easy to port pseudo code: [code] Function rit(px,py,pz, dx,dy,dz, V0x,V0y,V0z, V1x,V1y,V1z, V2x,V2y,V2z, Extend_To_Infinity=0, Cull_Backfaces=0) ; ray intersect triangle: px...= start point, dx...=offset to start point (start+offset=end point) ;- E1x = V2x - V0x E1y = V2y - V0y E1z = V2z - V0z ;- E2x = V1x - V0x E2y = V1y - V0y E2z = V1z - V0z ; Hxyz = Crossproduct(Dxyz, E2xyz) Hx = (Dy * E2z) - (E2y * Dz) Hy = (Dz * E2x) - (E2z * Dx) Hz = (Dx * E2y) - (E2x * Dy) ; Calculate the dot product of the above vector and the vector between point 0 and point 2. A = (E1x * Hx) + (E1y * Hy) + (E1z * Hz) ;cull If (Cull_Backfaces = 1) And (A >= 0) Then Return 0 ;parallel? If (A > -0.00001) And (A < 0.00001) Then Return 0 ;Inverse Determinant F = 1.0 / A ;- Sx = Px - V0x Sy = Py - V0y Sz = Pz - V0z ; U = F * (DotProduct(Sxyz, Hxyz)) U = F * ((Sx * Hx) + (Sy * Hy) + (Sz * Hz)) ;check u If (U < 0.0) Or (U > 1.0) Return 0 ; Qxyz = CrossProduct(Sxyz, E1xyz) Qx = (Sy * E1z) - (E1y * Sz) Qy = (Sz * E1x) - (E1z * Sx) Qz = (Sx * E1y) - (E1x * Sy) ; V = F * DotProduct(Dxyz, Qxyz) V = F * ((Dx * Qx) + (Dy * Qy) + (Dz * Qz)) ;check v If (V < 0.0) Or ((U + V) > 1.0) Return 0 T = F*((E2x*Qx)+(E2y*Qy)+(E2z*Qz)) If T<0 Return 0; orig ;If T<=0 Return 0 If (Extend_To_Infinity=0) And (T>1) Return 0 ;intersects Return 1 End Function [/code][/quote]
Possible Codes
Feature
Code
Link
[url] www.example.com [/url]
Bold
[b]bold text[/b]
Image
[img]http://www.example.com/image.jpg[/img]
Quote
[quote]quoted text[/quote]
Code
[code]source code[/code]
Emoticons
Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact