Esempio n. 1
0
 protected void drawNormalTrack()
 {
     for (int i = 0; i < _vertexs.Length; i++)
     {
         for (int j = 0; j < _vertexs[i].normals.Count; j++)
         {
             NORMAL  normal    = _vertexs[i].normals[j];
             Vector3 normalEnd = _vertexs[i].pos + normal.direct * 0.5f;
             Debug.DrawLine(_vertexs[i].pos, normalEnd, Color.yellow);
         }
     }
 }
Esempio n. 2
0
 protected void createNormal()
 {
     normals = new NORMAL[surfaceNum];
     for (int i = 0; i < surfaceNum; i++)
     {
         normals[i] = new NORMAL();
     }
     for (int i = 0; i < vertexNum; i++)
     {
         _vertexs[i].initNormal();
     }
 }
Esempio n. 3
0
        public Disk(Vector3 center, Vector3 normal, float radius, bool twoside = true)
        {
            CENTER   = center;
            NORMAL   = normal.Nor();
            RADIUS   = radius;
            TWO_SIZE = twoside;

            m_tempPoint = center;
            m_area      = radius * radius * TracerConst.PI;
            m_pdf       = 1.0f / m_area;

            m_vecx = NORMAL.Cross(Vector3.UpJitted);
            m_vecy = m_vecx.Cross(NORMAL);
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void test()
        public virtual void test()
        {
            for (int i = 0; i < 10; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double y = 5 * NORMAL.nextRandom();
                double y = 5 * NORMAL.nextRandom();
                assertRoundTrip(NULL_TRANSFORM, y);
                assertReverseRoundTrip(NULL_TRANSFORM, y);
                assertGradient(NULL_TRANSFORM, y);
                assertInverseGradient(NULL_TRANSFORM, y);
                assertGradientRoundTrip(NULL_TRANSFORM, y);
            }
        }
Esempio n. 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testUpper()
        public virtual void testUpper()
        {
            for (int i = 0; i < 10; i++)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double x = A + 5 * Math.log(RANDOM.nextDouble());
                double x = A + 5 * Math.Log(RANDOM.NextDouble());
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double y = 5 * NORMAL.nextRandom();
                double y = 5 * NORMAL.nextRandom();
                assertRoundTrip(UPPER_LIMIT, x);
                assertReverseRoundTrip(UPPER_LIMIT, y);
                assertGradient(UPPER_LIMIT, x);
                assertInverseGradient(UPPER_LIMIT, y);
                assertGradientRoundTrip(UPPER_LIMIT, x);
            }
        }
    public static void collideSceneObjProcess()
    {
        SCENE_OBJ A = collideInfo.vertex.belongToObj;  //vertex
        SCENE_OBJ B = collideInfo.surface.belongToObj; //surface

        //Debug.Log ( "collide occur!!(" + A.transform.name + "," + B.transform.name + ")" + collideInfo.minCollideTime );
        newContactA.reset();
        newContactB.reset();
        newContactA.other = B;
        newContactB.other = A;
        newContactA.self  = A;
        newContactB.self  = B;
        //newContactA.coupleContactInfo = newContactB;
        //newContactB.coupleContactInfo = newContactA;
        newContactA.blockDirect = collideInfo.surface.normal.direct;
        newContactB.blockDirect = -newContactA.blockDirect;


        //record surface
        newContactA.otherSurface = newContactB.otherSurface = collideInfo.surface;
        //if surface contact surface record surface
        bool isSurfaceContact = false;

        for (int i = 0; i < collideInfo.vertex.normals.Count; i++)
        {
            NORMAL normal = collideInfo.vertex.normals[i];
            if (normal.direct == -collideInfo.surface.normal.direct)
            {
                newContactA.selfSurface = newContactB.selfSurface = normal.surface;
                isSurfaceContact        = true;
                break;
            }
        }
        //otherwise record vertex
        if (!isSurfaceContact)
        {
            newContactA.selfVertex = newContactB.selfVertex = collideInfo.vertex;
        }

        A.collideAction(newContactA);
        B.collideAction(newContactB);

        A.informBelongToObj(newContactA);
        B.informBelongToObj(newContactB);
    }
Esempio n. 7
0
 protected void initNormal()
 {
     for (int i = 0; i < surfaceNum; i++)
     {
         normals[i].init(_surfaces[i]);
         _surfaces[i].normal = normals[i];
     }
     for (int i = 0; i < surfaceNum; i++)
     {
         NORMAL   normal        = _surfaces[i].normal;
         VERTEX[] surfacePoints = _surfaces[i].points;
         for (int j = 0; j < surfacePoints.Length; j++)
         {
             VERTEX vertex = surfacePoints[j];
             vertex.normals.Add(normal);
         }
     }
 }