#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ test_view_3dim_in_2dim Script file to test function that projects points in 3D to points in 2D image plane. Created on Thu Dec 31 10:15:09 2020 @author: necotter """ #import importlib as imp #from imp import reload #import matplotlib import matplotlib.pyplot as plt import numpy as np import SNN_viewpoint as view_pt #import view_3dim_in_2dim as v32 #+from view_3dim_in_2dim import v32 from two_dim_view import view2D # Create structure with default view_point, focal_point, and origin. view1 = view_pt.ViewPt() #view_point = np.array([2,3,4]) #print('view_point = ',view_point) #+focal_point = np.array([0,0,0]) # Create two points for a line. pts_3dim = np.array([[1,1,1],[2,2,2]]) #v32.Image3Din2D([2,3,4],[0,0,0],[[1,1,1],[2,2,2]]) #+cube_pts = v32(view_point,focal_point,pts_3dim) #cube_pts = view2D(view_point,focal_point,pts_3dim) # Project the line into 2-D image line_pts_2D = view2D(view1, pts_3dim); print('After view2D() function') #import pyplotexamp # Print the points on the line in 2D. print(line_pts_2D[:,0]) print(line_pts_2D[:,1]) print() # Plot the points on the line in 2D as thin green line. plt.plot([-6,6],[-6,6],'g-',linewidth=0.5) # Plot a short, thick, blue line in blue. plt.plot(line_pts_2D[:,0],line_pts_2D[:,1],'b-',linewidth=3.0)