コード例 #1
0
ファイル: toy.py プロジェクト: bsergean/oglshow
def test6():
    from math_utils import rayIntersectsTriangle
    print rayIntersectsTriangle(
        [.2, .2, 1],
        [10, 10, 10],  # [0, 0, -1],
        [0, 0, 0],
        [0, 1, 0],
        [1, 0, 0])
コード例 #2
0
ファイル: octree.py プロジェクト: bsergean/oglshow
        def ray_intersect_octree_rec(node, ray, sc):
            ret = []
            if node.bb.intersect(ray):
                if not node.childs:
                    for t in node.faces:
                        v1 = sc.points[t[0]]
                        v2 = sc.points[t[1]]
                        v3 = sc.points[t[2]]
                        intersection = rayIntersectsTriangle(ray[0], ray[1],
                            v1, v2, v3)
                        # print_tri( v1, v2, v3 )
                        # print 'hit ?', intersection
                        if intersection:
                            ret.append( (t, intersection) )

                for child in node.childs:
                    ret.extend( ray_intersect_octree_rec(child, ray, sc) )

            return ret
コード例 #3
0
ファイル: toy.py プロジェクト: bsergean/oglshow
def test6():
    from math_utils import rayIntersectsTriangle
    print rayIntersectsTriangle([.2, .2, 1], [10, 10, 10], # [0, 0, -1],
        [0, 0, 0], [0, 1, 0], [1, 0, 0]
    )