Bu hata kodu bir ..sabit nesne var parametre olarak kabul edilemez
multresult := mult(mult(temp, quatview), conjugate(temp));
Tam prosedür
procedure TForm2.RotateCamera(var angle: Single; x: Single; y: Single; z: Single);
var
temp, QuatView, multResult : TQuaternion;
begin
temp.x := x * sin(Angle/2);
temp.y := y * sin(Angle/2);
temp.z := z * sin(Angle/2);
temp.w := cos(Angle/2);
quatview.x := camera1.Position.x;
quatview.y := camera1.Position.y;
quatview.z := camera1.Position.z;
quatview.w := 0;
multresult := mult(mult(temp, quatview), conjugate(temp));
camera1.Position.x := multresult.x;
camera1.Position.y := multresult.y;
camera1.Position.z := multresult.z;
end;
fazla fonksiyon
function TForm2.mult(var A: TQuaternion; B: TQuaternion) :TQuaternion;
var
c : TQuaternion;
begin
C.x := A.w*B.x + A.x*B.w + A.y*B.z - A.z*B.y;
C.y := A.w*B.y - A.x*B.z + A.y*B.w + A.z*B.x;
C.z := A.w*B.z + A.x*B.y - A.y*B.x + A.z*B.w;
C.w := A.w*B.w - A.x*B.x - A.y*B.y - A.z*B.z;
result := C;
End;
ve konjugat
function TForm2.conjugate(var quat:TQuaternion) :TQuaternion;
begin
quat.x := -quat.x;
quat.y := -quat.y;
quat.z := -quat.z;
result := quat;
end;
ben bu hatayı alıyorum ve nasıl bunu düzeltmek için neden
ve eğer
type
TQuaternion = class
x: single;
y: single;
z: single;
w: single;
end;
TQuaternion
bir fikrin gerekli?
Teşekkürler, harika tavsiye. Bunu tekrar deneyeceğim ve kullanacağım ... şu andan itibaren firemonkey kamera ile nasıl kullanılacağını öğrenmem gerekiyor .. FMX'in pozisyonu (x, y, z) ve döndürme (x, y, z) opengl'in görünümünü (positionx, y, z, viewx, y, z, upx, y, z) bulabildiğim örnekler. –