導航:首頁 > 編程語言 > java3d向量計算

java3d向量計算

發布時間:2023-05-14 23:14:00

Ⅰ 怎樣在java3d裡面實現 自動旋轉效果

查看點就是個3維向量
計算移動的時候把方向也一並計算就好了
JAVA 3D不熟悉 以前搞Direct3D的 也忘光了

Ⅱ 編寫一個函數,計算3D向量的模

#include <iostream>
#include <cmath>
using namespace std;

struct Vector3D
{
float x;
float y;
float z;

Vector3D()
:x(0), y(0), z(0)
{ }

Vector3D(float x, float y, float z)
{
this->埋乎x = x;
this->y = y;
this->z = z;
}

Vector3D operator-(Vector3D &v)
{
Vector3D r;
r.x = this->x - v.x;
r.y = this->y - v.y;
r.z = this->z - v.z;
return r;
}

float length() const
{
return sqrt(x * x + y * y + z * z);
}

void output() const
{
cout << "(" <侍棗< x << "," << y << "," << z <<"彎談悉)" << endl;;
}
};

int main(void)
{
Vector3D v1(3, 2, 1);
Vector3D v2(1, 1, 1);
Vector3D v = v1 - v2;
v1.output();
v2.output();
v.output();
cout << v.length() << endl;

return 0;
}

Ⅲ java向量

publicclassTest7{
//cos夾角=a向量點乘b向量/(a向量的模*b向量的模),這里沒有考版慮經度問題。
publicstaticvoidmain(String[]args){
權intx1=3,y1=4,z1=5;
intx2=6,y2=8,z2=10;
doublediancheng=x1*x2+y1*y2+z1*z2;
doubleaa=Math.sqrt(Math.pow(x1,2)+Math.pow(y1,2)+Math.pow(z1,2));
doublebb=Math.sqrt(Math.pow(x2,2)+Math.pow(y2,2)+Math.pow(z2,2));
doublecos=Math.round(diancheng/(aa*bb));
System.out.println("夾角為:"+Math.acos(cos));
}
}

Ⅳ java中向量計算用array

第一個問題,for那裡的最後的那個; 去掉就可以了
for(int i = 0; i<v1.length; i++)

第二個問題版
public double getSum(double[] v1, double length){
權for(int i = 0; i < v1.length; i++){
length = length + v1[i] * v1[i];
}

return length;
}

第三個問題
沒有明白你的『點乘『要干什麼

閱讀全文

與java3d向量計算相關的資料

熱點內容
中國萬年歷安卓版 瀏覽:99
小米6a移動數據打不開怎麼回事 瀏覽:809
電腦編程3d用什麼軟體 瀏覽:170
浮動qq設計 瀏覽:279
word文件怎樣發送到qq裡面 瀏覽:380
社會化購物網站 瀏覽:402
怎麼安裝描述文件 瀏覽:534
微信小程序im通訊 瀏覽:644
php從資料庫讀取數據 瀏覽:330
蘋果手機安裝描述文件應用下架 瀏覽:480
安全程序文件包含哪些 瀏覽:612
ibatis查詢資料庫 瀏覽:453
手機卸載文件找不到文件怎麼辦 瀏覽:545
百度網盤app下載的壓縮文件怎麼導出來 瀏覽:254
小米5開發版驅動程序 瀏覽:785
微信附近搜索怎樣打開 瀏覽:543
ios7那個版本越獄好 瀏覽:344
壓縮文件如何分割 瀏覽:458
蘋果4s怎麼沒地方插卡 瀏覽:943
資料庫的組成對象11 瀏覽:944

友情鏈接