70 lines
2.0 KiB
Python
70 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test script for progressive 3D animation function
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
sys.path.append('/home/pi/Desktop/traccar_animation')
|
|
|
|
def test_progressive_3d_animation():
|
|
"""Test the progressive 3D animation dependencies"""
|
|
|
|
print("Testing progressive 3D animation dependencies...")
|
|
|
|
try:
|
|
# Test matplotlib with 3D
|
|
import matplotlib
|
|
matplotlib.use('Agg') # Non-interactive backend
|
|
import matplotlib.pyplot as plt
|
|
from mpl_toolkits.mplot3d import Axes3D
|
|
print("✅ Matplotlib with 3D support available")
|
|
|
|
# Test OpenCV (instead of MoviePy)
|
|
import cv2
|
|
print("✅ OpenCV available for video creation")
|
|
|
|
# Test numpy
|
|
import numpy as np
|
|
print("✅ NumPy available")
|
|
|
|
# Test basic 3D plot creation
|
|
fig = plt.figure(figsize=(8, 6))
|
|
ax = fig.add_subplot(111, projection='3d')
|
|
|
|
# Create simple test data
|
|
x = np.array([0, 1, 2, 3, 4])
|
|
y = np.array([0, 1, 0, 1, 0])
|
|
z = np.array([0, 0, 1, 1, 2])
|
|
|
|
ax.plot(x, y, z, 'b-', linewidth=2)
|
|
ax.scatter(x, y, z, c='red', s=50)
|
|
ax.set_xlabel('X')
|
|
ax.set_ylabel('Y')
|
|
ax.set_zlabel('Z')
|
|
ax.set_title('Test 3D Plot')
|
|
|
|
# Save test plot
|
|
test_path = '/tmp/test_3d_plot.png'
|
|
plt.savefig(test_path, dpi=100, bbox_inches='tight')
|
|
plt.close(fig)
|
|
|
|
if os.path.exists(test_path):
|
|
print("✅ 3D plot creation and saving works")
|
|
os.remove(test_path)
|
|
else:
|
|
print("❌ Failed to create 3D plot")
|
|
|
|
except ImportError as e:
|
|
print(f"❌ Import error: {e}")
|
|
return False
|
|
except Exception as e:
|
|
print(f"❌ Error: {e}")
|
|
return False
|
|
|
|
print("🎉 All dependencies for progressive 3D animation are working!")
|
|
return True
|
|
|
|
if __name__ == "__main__":
|
|
test_progressive_3d_animation()
|