XNA c#bundingboxの(min、max)与えられたキューブの12の三角形の面を取得する

StackOverflow https://stackoverflow.com/questions/2718748

  •  01-10-2019
  •  | 
  •  

質問

キューブの12の三角形を取得する簡単な方法またはC#クラスはありますか?ここでは、Boundingboxキューブで(最小、最大)座標のみが知られています。プリミティベティプ。キューブの最大頂点で定義できる12個の三角形の静的インデックスアレイ。

XNAでC#を使用しています。

役に立ちましたか?

解決

私はそれを理解しました....これは私のために働いています..それがそれをするための一般化された方法ではないでしょう

static float a , b , h ;

        static Vector3 MinV = new Vector3(0f, 0f, 0f);
        static Vector3 MaxV = new Vector3(a, b, h);

        Vector3 topLeftBack = new Vector3(MinV.X, MaxV.Y, MinV.Z);
        Vector3 topRightBack = new Vector3(MaxV.X, MaxV.Y, MinV.Z);
        Vector3 bottomLeftBack = new Vector3(MinV.X, MinV.Y, MinV.Z); //min
        Vector3 bottomRightBack = new Vector3(MaxV.X, MinV.Y, MinV.Z);

        Vector3 topLeftFront = new Vector3(MinV.X, MaxV.Y, MaxV.Z);
        Vector3 topRightFront = new Vector3(MaxV.X, MaxV.Y, MaxV.Z);  //max  
        Vector3 bottomLeftFront = new Vector3(MinV.X, MinV.Y, MaxV.Z);
        Vector3 bottomRightFront = new Vector3(MaxV.X, MinV.Y, MaxV.Z);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top