コード例 #1
0
ファイル: Line.cs プロジェクト: topfs2/teslagame
        public Line(Vector3f pointAOnLine, Vector3f pointBOnLine, Vector3f pointNotOnLine)
        {
            p0 = new Plane(pointAOnLine, pointBOnLine, pointNotOnLine);
            Vector3f temp = pointAOnLine - pointBOnLine;

            p1 = new Plane(temp.Cross(p1.getNormal()), pointAOnLine);
        }
コード例 #2
0
ファイル: Plane.cs プロジェクト: topfs2/teslagame
        public Plane(Vector3f p0, Vector3f p0A, Vector3f p0B)
        {
            Vector3f vecA   = p0A - p0;
            Vector3f vecB   = p0B - p0;
            Vector3f normal = vecA.Cross(vecB);

            a = normal.x;
            b = normal.y;
            c = normal.z;
            d = -1.0f * (normal * p0);
        }
コード例 #3
0
 public RotatableGroundPlane(Vector3f position, float deltaY_X, float deltaY_Z, float friction)
 {
     active = true;
     this.friction = friction;
     this.position = position;
     this.deltaY_X = deltaY_X;
     this.deltaY_Z = deltaY_Z;
     Vector3f vectorA = new Vector3f(1.0f, -deltaY_X, 0.0f);
     Vector3f vectorB = new Vector3f(0.0f, -deltaY_Z, 1.0f);
     normal = vectorA.Cross(vectorB);
     normal.Normalize();
 }
コード例 #4
0
ファイル: Vector3fTest.cs プロジェクト: topfs2/teslagame
 public void crossProductWithZeros()
 {
     v0 = new Vector3f(1.0f, 0.0f, 0.0f);
     v1 = new Vector3f(0.0f, 0.0f, -1.0f);
     Assert.AreEqual(v0.Cross(v1), new Vector3f(0.0f, 1.0f, 0.0f), v0.ToString() + "x" + v1.ToString());
 }
コード例 #5
0
ファイル: Vector3fTest.cs プロジェクト: topfs2/teslagame
 public void crossProduct()
 {
     v0 = new Vector3f(3.0f, 0.0f, 0.0f);
     v1 = new Vector3f(0.0f, 2.0f, 0.0f);
     Assert.AreEqual(v0.Cross(v1), new Vector3f(0.0f, 0.0f, 6.0f), v0.ToString() + "x" + v1.ToString());
 }