Esempio n. 1
0
def get_object_frame(remote, object_id):
    """get local frame of object"""
    cmd = mmapi.StoredCommands()
    cmd_key = cmd.AppendSceneCommand_GetObjectFrame(object_id)
    remote.runCommand(cmd)
    cur_frame = mmapi.frame3f()
    cmd.GetSceneCommandResult_GetObjectFrame(cmd_key, cur_frame)
    f = mmFrame()
    f.set_frame3f(cur_frame)
    return f
Esempio n. 2
0
def find_nearest(remote, position):
    cmd = mmapi.StoredCommands()
    v = mmapi.vec3f()
    key = cmd.AppendQueryCommand_FindNearestPoint(position[0], position[1], position[2]);
    remote.runCommand(cmd)
    frame = mmapi.frame3f()
    bOK = cmd.GetQueryResult_FindNearestPoint(key, frame)
    hitFrame = mmFrame()
    hitFrame.setFromMM(frame)
    return (bOK, hitFrame)
Esempio n. 3
0
def find_nearest(remote, position):
    """Find the nearest point on the 3D surface to the input 3-tuple. Returns a tuple (bOK, hitFrame), where bOK is a boolean indicating if a nereast point was found, and hitFrame is an mmFrame at the hit point, with Z axis oriented to the surface normal"""
    cmd = mmapi.StoredCommands()
    v = mmapi.vec3f()
    key = cmd.AppendQueryCommand_FindNearestPoint(position[0], position[1], position[2]);
    remote.runCommand(cmd)
    frame = mmapi.frame3f()
    bOK = cmd.GetQueryResult_FindNearestPoint(key, frame)
    hitFrame = mmFrame()
    hitFrame.setFromMM(frame)
    return (bOK, hitFrame)
Esempio n. 4
0
def find_nearest(remote, position):
    cmd = mmapi.StoredCommands()
    v = mmapi.vec3f()
    key = cmd.AppendQueryCommand_FindNearestPoint(position[0], position[1],
                                                  position[2])
    remote.runCommand(cmd)
    frame = mmapi.frame3f()
    bOK = cmd.GetQueryResult_FindNearestPoint(key, frame)
    hitFrame = mmFrame()
    hitFrame.setFromMM(frame)
    return (bOK, hitFrame)
Esempio n. 5
0
def find_nearest(remote, position):
    """Find the nearest point on the 3D surface to the input 3-tuple. Returns a tuple (bOK, hitFrame), where bOK is a boolean indicating if a nereast point was found, and hitFrame is an mmFrame at the hit point, with Z axis oriented to the surface normal"""
    cmd = mmapi.StoredCommands()
    v = mmapi.vec3f()
    key = cmd.AppendQueryCommand_FindNearestPoint(position[0], position[1], position[2]);
    remote.runCommand(cmd)
    frame = mmapi.frame3f()
    bOK = cmd.GetQueryResult_FindNearestPoint(key, frame)
    hitFrame = mmFrame()
    hitFrame.set_frame3f(frame)
    return (bOK, hitFrame)
Esempio n. 6
0
def find_ray_hit(remote, ray_origin, ray_direction):
    cmd = mmapi.StoredCommands()
    o = mmapi.vec3f()
    o.x = ray_origin[0]; o.y = ray_origin[1]; o.z = ray_origin[2]
    d = mmapi.vec3f()
    d.x = ray_direction[0]; d.y = ray_direction[1]; d.z = ray_direction[2]
    key = cmd.AppendQueryCommand_FindRayIntersection(o,d)
    remote.runCommand(cmd)
    frame = mmapi.frame3f()
    bOK = cmd.GetQueryResult_FindRayIntersection(key, frame)
    hitFrame = mmFrame()
    hitFrame.setFromMM(frame)
    return (bOK, hitFrame)
Esempio n. 7
0
def find_ray_hit(remote, ray_origin, ray_direction):
    """Find the intersection of a ray (specified by 3-tuples for origin and direction) and the 3D surface. Returns a tuple (bOK, hitFrame), where bOK is a boolean indicating if a hit was found, and hitFrame is an mmFrame at the hit point, with Z axis oriented to the surface normal"""
    cmd = mmapi.StoredCommands()
    o = mmapi.vec3f()
    o.x = ray_origin[0]; o.y = ray_origin[1]; o.z = ray_origin[2]
    d = mmapi.vec3f()
    d.x = ray_direction[0]; d.y = ray_direction[1]; d.z = ray_direction[2]
    key = cmd.AppendQueryCommand_FindRayIntersection(o,d)
    remote.runCommand(cmd)
    frame = mmapi.frame3f()
    bOK = cmd.GetQueryResult_FindRayIntersection(key, frame)
    hitFrame = mmFrame()
    hitFrame.setFromMM(frame)
    return (bOK, hitFrame)
Esempio n. 8
0
def find_ray_hit(remote, ray_origin, ray_direction):
    """Find the intersection of a ray (specified by 3-tuples for origin and direction) and the 3D surface. Returns a tuple (bOK, hitFrame), where bOK is a boolean indicating if a hit was found, and hitFrame is an mmFrame at the hit point, with Z axis oriented to the surface normal"""
    cmd = mmapi.StoredCommands()
    o = mmapi.vec3f()
    o.x = ray_origin[0]; o.y = ray_origin[1]; o.z = ray_origin[2]
    d = mmapi.vec3f()
    d.x = ray_direction[0]; d.y = ray_direction[1]; d.z = ray_direction[2]
    key = cmd.AppendQueryCommand_FindRayIntersection(o,d)
    remote.runCommand(cmd)
    frame = mmapi.frame3f()
    bOK = cmd.GetQueryResult_FindRayIntersection(key, frame)
    hitFrame = mmFrame()
    hitFrame.set_frame3f(frame)
    return (bOK, hitFrame)
Esempio n. 9
0
 def get_frame3f(self):
     """return mmapi.frame3f version of this frame"""
     f = mmapi.frame3f()
     f.origin_x = self.origin[0]
     f.origin_y = self.origin[1]
     f.origin_z = self.origin[2]
     f.tan1_x = self.x[0]
     f.tan1_y = self.x[1]
     f.tan1_z = self.x[2]
     f.tan2_x = self.y[0]
     f.tan2_y = self.y[1]
     f.tan2_z = self.y[2]
     f.normal_x = self.z[0]
     f.normal_y = self.z[1]
     f.normal_z = self.z[2]
     return f
Esempio n. 10
0
 def get_frame3f(self):
     """return mmapi.frame3f version of this frame"""
     f = mmapi.frame3f()
     f.origin_x = self.origin[0]
     f.origin_y = self.origin[1]
     f.origin_z = self.origin[2]
     f.tan1_x = self.x[0]
     f.tan1_y = self.x[1]
     f.tan1_z = self.x[2]
     f.tan2_x = self.y[0]
     f.tan2_y = self.y[1]
     f.tan2_z = self.y[2]
     f.normal_x = self.z[0]
     f.normal_y = self.z[1]
     f.normal_z = self.z[2]
     return f
Esempio n. 11
0
def find_ray_hit(remote, ray_origin, ray_direction):
    cmd = mmapi.StoredCommands()
    o = mmapi.vec3f()
    o.x = ray_origin[0]
    o.y = ray_origin[1]
    o.z = ray_origin[2]
    d = mmapi.vec3f()
    d.x = ray_direction[0]
    d.y = ray_direction[1]
    d.z = ray_direction[2]
    key = cmd.AppendQueryCommand_FindRayIntersection(o, d)
    remote.runCommand(cmd)
    frame = mmapi.frame3f()
    bOK = cmd.GetQueryResult_FindRayIntersection(key, frame)
    hitFrame = mmFrame()
    hitFrame.setFromMM(frame)
    return (bOK, hitFrame)