This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import time | |
def rotation_matrix(axis, theta): | |
axis = axis / np.linalg.norm(axis) | |
a = np.cos(theta / 2.0) | |
b, c, d = -axis*np.sin(theta / 2.0) | |
aa, bb, cc, dd = a*a, b*b, c*c, d*d | |
bc, ad, ac, ab, bd, cd = b*c, a*d, a*c, a*b, b*d, c*d | |
return np.array([[aa+bb-cc-dd, 2*(bc+ad), 2*(bd-ac), 0], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import time | |
from math import cos, sin, acos, sqrt | |
# --- Quaternion utility functions for rotations --- | |
def quat_from_axis_angle(axis, angle_rad): | |
axis = axis / np.linalg.norm(axis) | |
s = sin(angle_rad / 2) | |
return np.array([cos(angle_rad/2), axis[0]*s, axis[1]*s, axis[2]*s]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame as g, sys, math | |
import numpy as n | |
# Init | |
g.init() | |
s = g.display.set_mode((800, 600)) | |
w, h = s.get_size() | |
g.display.set_caption("3D LOS with NumPy Optimization") | |
c = g.time.Clock() | |
g.event.set_grab(True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import numpy as np | |
import sys | |
import math | |
# Initialize Pygame | |
pygame.init() | |
screen = pygame.display.set_mode((800, 600)) | |
pygame.display.set_caption("3D Line of Sight with Mouse Look") | |
clock = pygame.time.Clock() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import numpy as np | |
import sys | |
import math | |
# Initialize Pygame | |
pygame.init() | |
screen = pygame.display.set_mode((800, 600)) | |
pygame.display.set_caption("3D Line of Sight with Mouse Look") | |
clock = pygame.time.Clock() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import numpy as np | |
import sys | |
import math | |
# Initialize Pygame | |
pygame.init() | |
screen = pygame.display.set_mode((800, 600)) | |
pygame.display.set_caption("3D Line of Sight with Mouse Look") | |
clock = pygame.time.Clock() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import numpy as np | |
import sys | |
import math | |
# Initialize Pygame | |
pygame.init() | |
screen = pygame.display.set_mode((800, 600)) | |
pygame.display.set_caption("3D Line of Sight with Mouse Look") | |
clock = pygame.time.Clock() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import numpy as np | |
import sys | |
import math | |
# Initialize Pygame | |
pygame.init() | |
screen = pygame.display.set_mode((800, 600)) | |
pygame.display.set_caption("3D Line of Sight with Mouse Look") | |
clock = pygame.time.Clock() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import numpy as np | |
import sys | |
import math | |
# Initialize Pygame | |
pygame.init() | |
screen = pygame.display.set_mode((800, 600)) | |
pygame.display.set_caption("3D Line of Sight with Mouse Look") | |
clock = pygame.time.Clock() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import sys | |
import math | |
# Initialize Pygame | |
pygame.init() | |
screen = pygame.display.set_mode((800, 600)) | |
pygame.display.set_caption("3D Line of Sight with Mouse Look") | |
clock = pygame.time.Clock() | |
pygame.event.set_grab(True) |
NewerOlder