Module wm5 is a Python extension wrapper of Geometric Tools’ Wild Magic, the C++ library for real-time computer graphics and physics, mathematics, geometry, numerical analysis, and image analysis.
With module wm5 you can write code like this, for example:
from wm5 import Vector3d, Ray3d, Sphere3d, IntrRay3Sphere3d
# Create a ray.
origin = Vector3d(9999.9, 0, 0)
direction = Vector3d(-1, 0, 0)
ray = Ray3d(origin, direction)
# Create a sphere.
center = Vector3d(-1.0, 0, 0)
radius = 3.0
sphere = Sphere3d(center, radius)
# Intersect the ray and sphere.
intr = IntrRay3Sphere3d(ray, sphere)
intr.Find()
for index in range(intr.GetQuantity()):
point = intr.GetPoint(index)
# 2.0 0.0 0.0
# -4.0 0.0 0.0
print(point.X(), point.Y(), point.Z())
Start using Python Wild Magic now! Get the source code in the usual way:
git clone https://github.com/vmlaker/pythonwildmagic
Now just install it and you’re off and running Wild Magic in Python land!