tailieunhanh - 3d game engine programming phần 3

Phạt cảnh cáo ZFXPlane phương pháp cắt, kiểm tra các giao lộ của một tam giác với một chiếc máy bay, cũng sẽ báo cáo một ngã tư nếu tam giác chỉ đơn thuần là chạm máy bay. Điều đó có nghĩa rằng ít nhất một đỉnh nằm trên máy bay và không được nêu ra trên một mặt khác nhau hơn so với hai điểm khác. | Working with Planes 147 int n this- Classify vc0 if n this- Classify vc1 n this- Classify vc2 return false return true Intersects Tri Caution The method ZFXPlane Intersects which checks for the intersection of a triangle with a plane will also report an intersection if the triangle merely touches the plane. That means that at least one vertex lies on the plane and not yet on a different side than the other two points. Some applications might not want to interpret this as an intersection. Intersections Between Planes Interestingly you can also calculate whether two planes are colliding. As you know planes are extending themselves to infinity so there is only one case in which two planes do not intersect each other if both planes are parallel. If the planes intersect however the intersection has the form of a line not a single point. But that should be obvious. The following code is based on an implementation by David Eberly. The test for an intersection is actually pretty simple. To check for the parallel case you only need to build the cross product of the planes normal vectors. If the resulting vector of this cross product operation is the zero vector you know the planes are parallel. Tip Check out David Eberly s website at . It contains lots of source code and mathematical papers about 3D graphics in general and intersection detection in particular. bool ZFXPlane Intersects const ZFXPlane plane ZFXRay pIntersection ZFXVector vcCross float fSqrLength if cross product equals 0 planes are parallel this- m_vcN fSqrLength if fSqrLength 1e-08f return false TEAM LinG - Live Informative Non-cost and Genuine 148 Chapter 4 Fast 3D Calculus intersection line if needed if pIntersection float fN00 this- float fN01 this- m_vcN float fN11 float fDet fN00 fN11 - fN01 fN01 if _fabs fDet 1e-08f return false float fInvDet fDet float fC0 fN11 this- m_fD -

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.