Ejemplo n.º 1
0
        public static float sol_test_body(float dt,
                                          float[] T,
                                          float[] V,
                                          s_ball up,
                                          s_file fp,
                                          s_body bp)
        {
            float u, t = dt;

            float[] U = new float[3];
            float[] O = new float[3];
            float[] W = new float[3];

            s_node np = fp.m_nv[bp.m_ni];

            sol_body_p(O, fp, bp);
            sol_body_v(W, fp, bp);

            if ((u = sol_test_node(t, U, up, fp, np, O, W)) < t)
            {
                Vec3.v_cpy(T, U);
                Vec3.v_cpy(V, W);
                t = u;
            }
            return(t);
        }
Ejemplo n.º 2
0
 public static void sol_load_node(IntPtr fin, s_node np)
 {
     Binary.get_index(fin, ref np.m_si);
     Binary.get_index(fin, ref np.m_ni);
     Binary.get_index(fin, ref np.m_nj);
     Binary.get_index(fin, ref np.m_l0);
     Binary.get_index(fin, ref np.m_lc);
 }
Ejemplo n.º 3
0
        public static float sol_test_node(float dt,
                                          float[] T,
                                          s_ball up,
                                          s_file fp,
                                          s_node np,
                                          float[] o,
                                          float[] w)
        {
            float u, t = dt;

            float[] U = new float[3];
            int     i;

            /* Test all lumps */

            for (i = 0; i < np.m_lc; i++)
            {
                s_lump lp = fp.m_lv[np.m_l0 + i];

                if ((u = sol_test_lump(t, U, up, fp, lp, o, w)) < t)
                {
                    Vec3.v_cpy(T, U);
                    t = u;
                }
            }

            /* Test in front of this node */

            if (np.m_ni >= 0 &&
                sol_test_fore(t, up, fp.m_sv[np.m_si], o, w) != 0)
            {
                s_node nq = fp.m_nv[np.m_ni];

                if ((u = sol_test_node(t, U, up, fp, nq, o, w)) < t)
                {
                    Vec3.v_cpy(T, U);
                    t = u;
                }
            }

            /* Test behind this node */

            if (np.m_nj >= 0 &&
                sol_test_back(t, up, fp.m_sv[np.m_si], o, w) != 0)
            {
                s_node nq = fp.m_nv[np.m_nj];

                if ((u = sol_test_node(t, U, up, fp, nq, o, w)) < t)
                {
                    Vec3.v_cpy(T, U);
                    t = u;
                }
            }

            return(t);
        }