Common geometry drawing functions
in 3D Documentation
GS Simulation
Apr 12, 2019
CONTENTS
1 Examples 1
1.1 get_tilt_angle_full.py . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 tetra_premise_1.py . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 lemma4_fig4.py . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 [Link] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5 Case_C_omega_noise_fig.tex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.6 TeX group logo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.7 tetrahedron midsphere . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.8 tetrahedron circumscribed sphere . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Available Functions 5
Python Module Index 11
i
ii
CHAPTER
ONE
EXAMPLES
All the figures created with the 3D annotating toolbox.
1.1 get_tilt_angle_full.py
../../../figure_2_af_resized_powered.PNG
File to create this graph should be in the get_tilt_angle_full.py files. Need to isolate the drawing part.
1.2 tetra_premise_1.py
1
Common geometry drawing functions in 3D Documentation
𝐵 a
𝐸 𝐶
𝐻
𝐽
𝑁 𝐹
𝐴 𝐾 𝑁′
𝐺
𝐷
Fig. 1: Ceva’s theorem
2 Chapter 1. Examples
Common geometry drawing functions in 3D Documentation
1.3 lemma4_fig4.py
1.4 [Link]
1.5 Case_C_omega_noise_fig.tex
In ./otherstuff/data_text_files/
1.6 TeX group logo
In ./drawing_code/latex/logos_creation/tex_group_logo.tex
1.3. lemma4_fig4.py 3
Common geometry drawing functions in 3D Documentation
./figures/tex_group_logo.pdf
1.7 tetrahedron midsphere
1.8 tetrahedron circumscribed sphere
4 Chapter 1. Examples
CHAPTER
TWO
AVAILABLE FUNCTIONS
Created on Mon May 08 13:19:33 2017
3D vector drawing functions for basic elements in geometry.
annotate_program.CK(rotvec)
Cayley-Klein parameters. Important: the built rotation matrix is with its couterclockwise active sense. This is
basically the Rodriguez rotation formula in a matric form.
annotate_program.circle_arc(axis, start_v, end_v, num_points)
Return the data points of a circle. Axis is the center axis of the circle following right hand rules. Start_v is the
vector of the starting point on the circle. End_v is the ending point on the circle. Num_points is the total number
of points on the arc. More points give a smoother arc. Vectors take the form like [Link]([1,0,0]).
px = [Link]([1,0,0])
pA = [Link]([0.5,0.5,0.5])
n_vec = [Link](px/[Link](px),pA/[Link](pA))
arc_alpha = 0.3*tool.circle_arc(n_vec,px,pA,20)
larc_alpha, = [Link](arc_alpha[:,0],arc_alpha[:,1],arc_alpha[:,2],'r',lw=2)
annotate_program.circle_full(axis, start_v, radius, num_points)
Return drawing data of a full circle centered on origin, need a drawing here. start_v is the any vector paralel to
first data point. The plot command is needed to make circle visible. see code. To move the circle remember to
add circle center. See code.
v1 = [Link]([1,0,0])
n_vec = [Link]([0,0,1])
circle1 = circle_full(n_vec,v1,0.3,20) + circle_center
circle1, = [Link](circle1[:,0],circle1[:,1],circle1[:,2],'r',lw=2)
annotate_program.cylinder(ax2, c1, c2, radius)
Plot from cylinder’s both end circle’s centers c1 and c2 and radius.
5
Common geometry drawing functions in 3D Documentation
annotate_program.draw_perpendicular_sign(rot_vec, first_axis, second_axis, location_point,
ax, size)
Put a perpendicular symbol to a 90 degree corner. The rot_vec is a vector parralel to first_axis crosses sec-
onde_axis. First and seconde_axis are the two sides of the perp sign. Location_point is where the sign goes . ax
is the figure axes. size is the length of one side of the size.
annotate_program.draw_xyz_coordinate_unit_vectors(ax4)
Put xyz coordinate unit vectors with fancy arrows. See figure in circle_arc.
annotate_program.four_points_circle(p1, p2, p3, p4)
Return center and radius of a sphere suscribing four points p1~4.
annotate_program.incircle3D(point1, point2, point3)
Return the insubscribed circle’s center’s position pO, radius r and norm vec nv and three Ceva sidepoints
p12,p23,p31 from a triangle(p1,p2,p3). If you only need a partial results, put dummy or _ or use foo()[0,3,4].
pO,r,nv,p12,p23,p31 = incircle3D(p1,p2,p3)
pO,r, _,p12,p23,p31 = incircle3D(p1,p2,p3)
pO,r, _,dummy1,dummy2,dummy3 = incircle3D(p1,p2,p3)
p12,p23,p31 = incircle3D(p1,p2,p3)[3,4,5]
annotate_program.just2show_length_annotaion_usage()
To indicate equal lengthes by putting symbols on line segments.
mar_a = [Link](marker='_')
mar_a._transform = mar_a.get_transform().rotate_deg(-30)
ax2.scatter3D(*zip(pointA,),marker=mar_a,s=90,color='k')
mar2 = [Link](marker='$||$')
(continues on next page)
6 Chapter 2. Available Functions
Common geometry drawing functions in 3D Documentation
(continued from previous page)
mar2._transform = mar2.get_transform().rotate_deg(-5)
ax2.scatter3D(*zip(pointB,),marker=mar2,s=80,color='k')
mar1 = [Link](marker='$|||$')
mar1._transform = mar1.get_transform().rotate_deg(-15)
ax2.scatter3D(*zip(pointC,),marker=mar1,s=100,color='k')
ax2.scatter3D(*zip(point1,),marker='o',s=64,edgecolors='k',facecolor="None")
ax2.scatter3D(*zip(point2,),marker='s',s=64,edgecolors='k',facecolor="None")
ax2.scatter3D(*zip(point3,),marker='$=$',s=64,edgecolors='k',facecolor="None")
annotate_program.offset_curve(curve, length)
Translate the position of all points on a 3D curve according to each point’s normal direction described below,
by specified length in mm. This operation is in a 2D plane. The offset normal direction is right hand rule’s palm
direction, with four fingers point along the curve starting from the first point, and thumb pointing perpendicular
to the 2D plane, normally opposing the viewing direction.
./figures/tex_group_logo.pdf
annotate_program.plot_back(axes, midspherex, midspherey, midspherez, midsphereR)
7
Common geometry drawing functions in 3D Documentation
plot the lucid sphere, back part
annotate_program.plot_body_space_cone(ax, height_vec, side_vec, location_tip)
Plot a cone with the specified parameters.
annotate_program.plot_front(axes, midspherex, midspherey, midspherez, midsphereR)
plot the lucid sphere, front part. Used together with plot_back.
annotate_program.project_a_point_to_a_plane(out_point, plane_vec1, plane_vec2, any-
pointonplane)
Return a point which is projected normally to the plane by another point. in_point is a point on the plane. Vec1
cross Vec2 should go toward the out_point.
annotate_program.return_9point_circle_center(p1, p2, p3)
Return 9-points center using Euler’s line.
annotate_program.return_Menelaus_third_outer_point(pA, pB, pC, pD, pE)
Given points ABCDE, return point F. See figure below.
8 Chapter 2. Available Functions
Common geometry drawing functions in 3D Documentation
annotate_program.return_Menelaus_third_outer_point_2nd(pA, pB, pC, pD, pF)
Given points ABCDF, return point E. See figure above.
annotate_program.return_centroid(p1, p2, p3)
Return centroid by using Ceva Theorem.
annotate_program.return_circumcenter(p1, p2, p3)
Return circumcenter using centroid and orthocenter and the Euler’s line of a triangle. Another keyword: 9-point
circle. Fig here.
annotate_program.return_intersection_under_Ceva_Theorem(pA, pB, pC, pD, pE)
Given points ABCDE, return point O. See figure below.
This function also works for the following case where O is outside of triangle ABC. See fig. Image generated
by ceva_third_point.py.
annotate_program.return_orthocenter(p1, p2, p3)
Return orthocenter by first finding two points of foot of perpendicular then using Ceva Theorem.
annotate_program.return_third_point_on_a_triagle_under_Ceva_Theorem(pA, pB,
pC, pD,
pE)
Given points ABCDE, return point F.
9
Common geometry drawing functions in 3D Documentation
Also works when O is outside.
annotate_program.rotation_matrix(axis, theta_rad)
Return the rotation_matrix that actively rotate a vector.
annotate_program.rotmat_from_A_2_B(A, B)
Return the active r.h. rotation matrix constructed from rotation vector 𝐶 = 𝐴 × 𝐵. This matrix rotates any
object in the world frame using rotation vector C.
annotate_program.solve_tetra_insphere(r1, r2, r3, c)
Given the radia of three mutually tangent circles (on the outside) on a midsphere, and tetra’s c length (refer to
the fig in the note), return length a. Following the steps described in the note, one can get r4.
annotate_program.third_seg_incircled(x, y, r) √︁
𝑥𝑦𝑧
Return z following the relation of the xyz lengths bisect by incircle and the r radius. 𝑟 = 𝑥+𝑦+𝑧
The py script to generate this fig is the same as the script that generates the fig in the incircle3D funtion, the
incircle_triangle.py, but in a different git commit, tagged xyzr_thir_sed.
annotate_program.triangle_area(pA, pB, pC)
Given points ABC, return area using Heron’s Theorem.
10 Chapter 2. Available Functions
PYTHON MODULE INDEX
a
annotate_program, 5
11