123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- #include "la_5.h"
- #include "la_tns.h"
- #include "la_util.h"
- #include <math.h>
- extern tnsMain *T;
- void tnsInterpolatePerspective4dv(tnsVector4d LG, tnsVector4d RG, tnsVector4d L, tnsVector4d R, real T, tnsVector3d Result){
-
- real z = 1 / tnsLinearItp(1 / L[2], 1 / R[2], T);
-
-
-
- Result[0] = tnsLinearItp(L[0] / L[2], R[0] / R[2], T) * z;
- Result[1] = tnsLinearItp(L[1] / L[2], R[1] / R[2], T) * z;
- Result[2] = z;
-
-
-
-
-
-
-
- }
- tnsLineStrip *tnsCreateLineStrip(){
- tnsLineStrip *ls = CreateNew(tnsLineStrip);
- return ls;
- }
- tnsLineStripPoint *tnsAppendPoint(tnsLineStrip *ls, real X, real Y, real Z){
- tnsLineStripPoint *lsp = CreateNew(tnsLineStripPoint);
- lsp->P[0] = X;
- lsp->P[1] = Y;
- lsp->P[2] = Z;
- lstAppendItem(&ls->Points, lsp);
- ls->PointCount++;
- return lsp;
- }
- tnsLineStripPoint *tnsPushPoint(tnsLineStrip *ls, real X, real Y, real Z){
- tnsLineStripPoint *lsp = CreateNew(tnsLineStripPoint);
- lsp->P[0] = X;
- lsp->P[1] = Y;
- lsp->P[2] = Z;
- lstPushItem(&ls->Points, lsp);
- ls->PointCount++;
- return lsp;
- }
- void tnsRemovePoint(tnsLineStrip *ls, tnsLineStripPoint *lsp){
- lstRemoveItem(&ls->Points, lsp);
- FreeMem(lsp);
- }
- void tnsDestroyLineStrip(tnsLineStrip *ls){
- tnsLineStripPoint *lsp;
- while (lsp = lstPopItem(&ls->Points)){
- FreeMem(lsp);
- }
- FreeMem(ls);
- }
|