2011-06-26 17:16:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/*
  
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 *  * * * * *  BEGIN  GPL  LICENSE  BLOCK  * * * * * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  This  program  is  free  software ;  you  can  redistribute  it  and / or 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  modify  it  under  the  terms  of  the  GNU  General  Public  License 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  as  published  by  the  Free  Software  Foundation ;  either  version  2 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  of  the  License ,  or  ( at  your  option )  any  later  version . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  This  program  is  distributed  in  the  hope  that  it  will  be  useful , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  but  WITHOUT  ANY  WARRANTY ;  without  even  the  implied  warranty  of 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  MERCHANTABILITY  or  FITNESS  FOR  A  PARTICULAR  PURPOSE .   See  the 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  GNU  General  Public  License  for  more  details . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  You  should  have  received  a  copy  of  the  GNU  General  Public  License 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  along  with  this  program ;  if  not ,  write  to  the  Free  Software  Foundation , 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 13:34:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  Inc . ,  51  Franklin  Street ,  Fifth  Floor ,  Boston ,  MA  02110 - 1301 ,  USA . 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  The  Original  Code  is  Copyright  ( C )  2001 - 2002  by  NaN  Holding  BV . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  All  rights  reserved . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  This  is  a  new  part  of  Blender . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Contributor ( s ) :  Joseph  Gilbert ,  Campbell  Barton 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  * * * * *  END  GPL  LICENSE  BLOCK  * * * * * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 01:48:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/** \file blender/python/mathutils/mathutils_geometry.c
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *   \ ingroup  pymathutils 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 20:10:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-14 04:15:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <Python.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-25 22:44:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "mathutils_geometry.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* Used for PolyFill */  
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# ifndef MATH_STANDALONE  /* define when building outside blender */ 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#   include "MEM_guardedalloc.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#   include "BLI_blenlib.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#   include "BLI_boxpack2d.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#   include "BKE_displist.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#   include "BKE_curve.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2011-01-07 18:36:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BLI_math.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BLI_utildefines.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*-------------------------DOC STRINGS ---------------------------*/  
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_doc ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" The Blender geometry module "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//---------------------------------INTERSECTION FUNCTIONS--------------------
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_intersect_ray_tri_doc ,  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" .. function:: intersect_ray_tri(v1, v2, v3, ray, orig, clip=True) \n "  
						 
					
						
							
								
									
										
										
										
											2010-12-10 00:20:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Returns the intersection between a ray and a triangle, if possible, returns None otherwise. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v1: Point1 \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v2: Point2 \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v2: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v3: Point3 \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v3: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg ray: Direction of the projection \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type ray: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg orig: Origin \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type orig: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
									
										
										
										
											2011-04-14 12:19:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"    :arg clip: When False, don't restrict the intersection to the area of the triangle, use the infinite plane defined by the triangle. \n "  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"    :type clip: boolean \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :return: The point of intersection or None if no intersection is found \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: :class:`mathutils.Vector` or None \n "  
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_intersect_ray_tri ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * ray ,  * ray_off ,  * vec1 ,  * vec2 ,  * vec3 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  dir [ 3 ] ,  orig [ 3 ] ,  v1 [ 3 ] ,  v2 [ 3 ] ,  v3 [ 3 ] ,  e1 [ 3 ] ,  e2 [ 3 ] ,  pvec [ 3 ] ,  tvec [ 3 ] ,  qvec [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  det ,  inv_det ,  u ,  v ,  t ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  clip  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      " O!O!O!O!O!|i:intersect_ray_tri " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec2 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec3 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & ray , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & ray_off ,  & clip ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( vec1 - > size  ! =  3  | |  vec2 - > size  ! =  3  | |  vec3 - > size  ! =  3  | |  ray - > size  ! =  3  | |  ray_off - > size  ! =  3 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 01:25:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                " only 3D vectors for all parameters " ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BaseMath_ReadCallback ( vec1 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( vec2 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( vec3 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( ray )   = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( ray_off )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-06 16:38:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_v3_v3 ( v1 ,  vec1 - > vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( v2 ,  vec2 - > vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( v3 ,  vec3 - > vec ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-06 16:38:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_v3_v3 ( dir ,  ray - > vec ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									normalize_v3 ( dir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-06 16:38:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									copy_v3_v3 ( orig ,  ray_off - > vec ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* find vectors for two edges sharing v1 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sub_v3_v3v3 ( e1 ,  v2 ,  v1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sub_v3_v3v3 ( e2 ,  v3 ,  v1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* begin calculating determinant - also used to calculated U parameter */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cross_v3_v3v3 ( pvec ,  dir ,  e2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* if determinant is near zero, ray lies in plane of triangle */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									det  =  dot_v3v3 ( e1 ,  pvec ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-27 17:12:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( det  >  - 0.000001f  & &  det  <  0.000001f )  { 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Py_RETURN_NONE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									inv_det  =  1.0f  /  det ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* calculate distance from v1 to ray origin */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sub_v3_v3v3 ( tvec ,  orig ,  v1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* calculate U parameter and test bounds */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									u  =  dot_v3v3 ( tvec ,  pvec )  *  inv_det ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( clip  & &  ( u  <  0.0f  | |  u  >  1.0f ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Py_RETURN_NONE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* prepare to test the V parameter */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cross_v3_v3v3 ( qvec ,  tvec ,  e1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* calculate V parameter and test bounds */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									v  =  dot_v3v3 ( dir ,  qvec )  *  inv_det ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( clip  & &  ( v  <  0.0f  | |  u  +  v  >  1.0f ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Py_RETURN_NONE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* calculate t, ray intersects triangle */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									t  =  dot_v3v3 ( e2 ,  qvec )  *  inv_det ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									mul_v3_fl ( dir ,  t ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									add_v3_v3v3 ( pvec ,  orig ,  dir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 04:45:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  Vector_CreatePyObject ( pvec ,  3 ,  Py_NEW ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* Line-Line intersection using algorithm from mathworld.wolfram.com */  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_intersect_line_line_doc ,  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" .. function:: intersect_line_line(v1, v2, v3, v4) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Returns a tuple with the points on each line respectively closest to the other. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v1: First point of the first line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v2: Second point of the first line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v2: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v3: First point of the second line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v3: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v4: Second point of the second line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v4: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: tuple of :class:`mathutils.Vector`'s \n "  
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_intersect_line_line ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-06-02 08:29:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PyObject  * tuple ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									VectorObject  * vec1 ,  * vec2 ,  * vec3 ,  * vec4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  v1 [ 3 ] ,  v2 [ 3 ] ,  v3 [ 3 ] ,  v4 [ 3 ] ,  i1 [ 3 ] ,  i2 [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!O!:intersect_line_line " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec2 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec3 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec4 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( vec1 - > size  ! =  vec2 - > size  | |  vec1 - > size  ! =  vec3 - > size  | |  vec3 - > size  ! =  vec2 - > size )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 01:25:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                " vectors must be of the same size " ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BaseMath_ReadCallback ( vec1 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( vec2 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( vec3 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( vec4 )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( vec1 - > size  = =  3  | |  vec1 - > size  = =  2 )  { 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  result ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( vec1 - > size  = =  3 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-06 16:38:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											copy_v3_v3 ( v1 ,  vec1 - > vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											copy_v3_v3 ( v2 ,  vec2 - > vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											copy_v3_v3 ( v3 ,  vec3 - > vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											copy_v3_v3 ( v4 ,  vec4 - > vec ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											v1 [ 0 ]  =  vec1 - > vec [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											v1 [ 1 ]  =  vec1 - > vec [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											v1 [ 2 ]  =  0.0f ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											v2 [ 0 ]  =  vec2 - > vec [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											v2 [ 1 ]  =  vec2 - > vec [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											v2 [ 2 ]  =  0.0f ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											v3 [ 0 ]  =  vec3 - > vec [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											v3 [ 1 ]  =  vec3 - > vec [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											v3 [ 2 ]  =  0.0f ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											v4 [ 0 ]  =  vec4 - > vec [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											v4 [ 1 ]  =  vec4 - > vec [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											v4 [ 2 ]  =  0.0f ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										result  =  isect_line_line_v3 ( v1 ,  v2 ,  v3 ,  v4 ,  i1 ,  i2 ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( result  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* colinear */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Py_RETURN_NONE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											tuple  =  PyTuple_New ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 04:45:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											PyTuple_SET_ITEM ( tuple ,  0 ,  Vector_CreatePyObject ( i1 ,  vec1 - > size ,  Py_NEW ,  NULL ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											PyTuple_SET_ITEM ( tuple ,  1 ,  Vector_CreatePyObject ( i2 ,  vec1 - > size ,  Py_NEW ,  NULL ) ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  tuple ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 01:25:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                " 2D/3D vectors only " ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								//----------------------------geometry.normal() -------------------
  
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_normal_doc ,  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" .. function:: normal(v1, v2, v3, v4=None) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Returns the normal of the 3D tri or quad. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v1: Point1 \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v2: Point2 \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v2: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v3: Point3 \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v3: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v4: Point4 (optional) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v4: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_normal ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									VectorObject  * vec1 ,  * vec2 ,  * vec3 ,  * vec4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  n [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( PyTuple_GET_SIZE ( args )  = =  3 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!:normal " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                      & vector_Type ,  & vec1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                      & vector_Type ,  & vec2 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                      & vector_Type ,  & vec3 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( vec1 - > size  ! =  vec2 - > size  | |  vec1 - > size  ! =  vec3 - > size )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 01:25:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											                " vectors must be of the same size " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( vec1 - > size  <  3 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 01:25:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											                " 2D vectors unsupported " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( BaseMath_ReadCallback ( vec1 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    BaseMath_ReadCallback ( vec2 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    BaseMath_ReadCallback ( vec3 )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										normal_tri_v3 ( n ,  vec1 - > vec ,  vec2 - > vec ,  vec3 - > vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!O!:normal " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                      & vector_Type ,  & vec1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                      & vector_Type ,  & vec2 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                      & vector_Type ,  & vec3 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                      & vector_Type ,  & vec4 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( vec1 - > size  ! =  vec2 - > size  | |  vec1 - > size  ! =  vec3 - > size  | |  vec1 - > size  ! =  vec4 - > size )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 01:25:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											                " vectors must be of the same size " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( vec1 - > size  <  3 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 01:25:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											                " 2D vectors unsupported " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( BaseMath_ReadCallback ( vec1 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    BaseMath_ReadCallback ( vec2 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    BaseMath_ReadCallback ( vec3 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    BaseMath_ReadCallback ( vec4 )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										normal_quad_v3 ( n ,  vec1 - > vec ,  vec2 - > vec ,  vec3 - > vec ,  vec4 - > vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 04:45:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  Vector_CreatePyObject ( n ,  3 ,  Py_NEW ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//--------------------------------- AREA FUNCTIONS--------------------
  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_area_tri_doc ,  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" .. function:: area_tri(v1, v2, v3) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Returns the area size of the 2D or 3D triangle defined. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v1: Point1 \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v2: Point2 \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v2: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg v3: Point3 \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v3: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: float \n "  
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_area_tri ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * vec1 ,  * vec2 ,  * vec3 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!:area_tri " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec2 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec3 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( vec1 - > size  ! =  vec2 - > size  | |  vec1 - > size  ! =  vec3 - > size )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 01:25:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                " vectors must be of the same size " ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BaseMath_ReadCallback ( vec1 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( vec2 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( vec3 )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( vec1 - > size  = =  3 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  PyFloat_FromDouble ( area_tri_v3 ( vec1 - > vec ,  vec2 - > vec ,  vec3 - > vec ) ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if  ( vec1 - > size  = =  2 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  PyFloat_FromDouble ( area_tri_v2 ( vec1 - > vec ,  vec2 - > vec ,  vec3 - > vec ) ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 01:25:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                " only 2D,3D vectors are supported " ) ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_intersect_line_line_2d_doc ,  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" .. function:: intersect_line_line_2d(lineA_p1, lineA_p2, lineB_p1, lineB_p2) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg lineA_p1: First point of the first line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type lineA_p1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg lineA_p2: Second point of the first line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type lineA_p2: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg lineB_p1: First point of the second line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type lineB_p1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg lineB_p2: Second point of the second line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type lineB_p2: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :return: The point of intersection or None when not found \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: :class:`mathutils.Vector` or None \n "  
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_intersect_line_line_2d ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * line_a1 ,  * line_a2 ,  * line_b1 ,  * line_b2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-11 21:27:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  vi [ 2 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!O!:intersect_line_line_2d " , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									                      & vector_Type ,  & line_a1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & line_a2 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & line_b1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & line_b2 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BaseMath_ReadCallback ( line_a1 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( line_a2 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( line_b1 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( line_b2 )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-22 04:26:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-11 21:27:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( isect_seg_seg_v2_point ( line_a1 - > vec ,  line_a2 - > vec ,  line_b1 - > vec ,  line_b2 - > vec ,  vi )  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 04:45:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  Vector_CreatePyObject ( vi ,  2 ,  Py_NEW ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-19 11:12:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										Py_RETURN_NONE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_intersect_line_plane_doc ,  
						 
					
						
							
								
									
										
										
										
											2011-05-19 04:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" .. function:: intersect_line_plane(line_a, line_b, plane_co, plane_no, no_flip=False) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
									
										
										
										
											2012-04-22 08:36:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"    Calculate the intersection between a line (as 2 vectors) and a plane. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Returns a vector for the intersection or None. \n "  
						 
					
						
							
								
									
										
										
										
											2011-05-19 04:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg line_a: First point of the first line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type line_a: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg line_b: Second point of the first line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type line_b: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg plane_co: A point on the plane \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type plane_co: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg plane_no: The direction the plane is facing \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type plane_no: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg no_flip: Always return an intersection on the directon defined bt line_a -> line_b \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type no_flip: :boolean \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :return: The point of intersection or None when not found \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: :class:`mathutils.Vector` or None \n "  
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_intersect_line_plane ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
										
											2011-05-19 04:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * line_a ,  * line_b ,  * plane_co ,  * plane_no ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  no_flip  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-19 04:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  isect [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!O!|i:intersect_line_plane " , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									                      & vector_Type ,  & line_a , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & line_b , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & plane_co , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & plane_no , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & no_flip ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-19 04:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BaseMath_ReadCallback ( line_a )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( line_b )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( plane_co )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( plane_no )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-19 04:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ELEM4 ( 2 ,  line_a - > size ,  line_b - > size ,  plane_co - > size ,  plane_no - > size ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 09:54:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 01:25:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										                " geometry.intersect_line_plane(...):  " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                "  can't use 2D Vectors " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-19 04:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( isect_line_plane_v3 ( isect ,  line_a - > vec ,  line_b - > vec ,  plane_co - > vec ,  plane_no - > vec ,  no_flip )  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 04:45:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  Vector_CreatePyObject ( isect ,  3 ,  Py_NEW ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-19 04:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Py_RETURN_NONE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 05:56:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_intersect_plane_plane_doc ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" .. function:: intersect_plane_plane(plane_a_co, plane_a_no, plane_b_co, plane_b_no) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Return the intersection between two planes \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg plane_a_co: Point on the first plane \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type plane_a_co: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg plane_a_no: Normal of the first plane \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type plane_a_no: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg plane_b_co: Point on the second plane \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type plane_b_co: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg plane_b_no: Normal of the second plane \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type plane_b_no: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :return: The line of the intersection represented as a point and a vector \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: tuple pair of :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_intersect_plane_plane ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
										
											2011-11-20 05:56:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PyObject  * ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * plane_a_co ,  * plane_a_no ,  * plane_b_co ,  * plane_b_no ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  isect_co [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  isect_no [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!O!|i:intersect_plane_plane " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & plane_a_co , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & plane_a_no , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & plane_b_co , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & plane_b_no ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BaseMath_ReadCallback ( plane_a_co )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( plane_a_no )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( plane_b_co )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( plane_b_no )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 05:56:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ELEM4 ( 2 ,  plane_a_co - > size ,  plane_a_no - > size ,  plane_b_co - > size ,  plane_b_no - > size ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                " geometry.intersect_plane_plane(...):  " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                "  can't use 2D Vectors " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									isect_plane_plane_v3 ( isect_co ,  isect_no , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                     plane_a_co - > vec ,  plane_a_no - > vec , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                     plane_b_co - > vec ,  plane_b_no - > vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									normalize_v3 ( isect_no ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ret  =  PyTuple_New ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 04:45:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PyTuple_SET_ITEM ( ret ,  0 ,  Vector_CreatePyObject ( isect_co ,  3 ,  Py_NEW ,  NULL ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PyTuple_SET_ITEM ( ret ,  1 ,  Vector_CreatePyObject ( isect_no ,  3 ,  Py_NEW ,  NULL ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 05:56:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2011-06-26 07:21:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_intersect_line_sphere_doc ,  
						 
					
						
							
								
									
										
										
										
											2011-06-26 08:07:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" .. function:: intersect_line_sphere(line_a, line_b, sphere_co, sphere_radius, clip=True) \n "  
						 
					
						
							
								
									
										
										
										
											2011-06-26 07:21:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Takes a lines (as 2 vectors), a sphere as a point and a radius and \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    returns the intersection \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg line_a: First point of the first line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type line_a: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg line_b: Second point of the first line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type line_b: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg sphere_co: The center of the sphere \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type sphere_co: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg sphere_radius: Radius of the sphere \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type sphere_radius: sphere_radius \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :return: The intersection points as a pair of vectors or None when there is no intersection \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: A tuple pair containing :class:`mathutils.Vector` or None \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_intersect_line_sphere ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
										
											2011-06-26 07:21:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * line_a ,  * line_b ,  * sphere_co ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  sphere_radius ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  clip  =  TRUE ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 07:21:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  isect_a [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  isect_b [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!f|i:intersect_line_sphere " , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									                      & vector_Type ,  & line_a , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & line_b , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & sphere_co , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & sphere_radius ,  & clip ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 07:21:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BaseMath_ReadCallback ( line_a )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( line_b )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( sphere_co )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 07:21:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ELEM3 ( 2 ,  line_a - > size ,  line_b - > size ,  sphere_co - > size ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 09:54:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 01:25:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										                " geometry.intersect_line_sphere(...):  " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                "  can't use 2D Vectors " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 07:21:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 17:16:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										short  use_a  =  TRUE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										short  use_b  =  TRUE ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 17:16:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  lambda ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyObject  * ret  =  PyTuple_New ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 17:16:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-18 08:50:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										switch  ( isect_line_sphere_v3 ( line_a - > vec ,  line_b - > vec ,  sphere_co - > vec ,  sphere_radius ,  isect_a ,  isect_b ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											case  1 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! ( ! clip  | |  ( ( ( lambda  =  line_point_factor_v3 ( isect_a ,  line_a - > vec ,  line_b - > vec ) )  > =  0.0f )  & &  ( lambda  < =  1.0f ) ) ) )  use_a  =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												use_b  =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  2 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! ( ! clip  | |  ( ( ( lambda  =  line_point_factor_v3 ( isect_a ,  line_a - > vec ,  line_b - > vec ) )  > =  0.0f )  & &  ( lambda  < =  1.0f ) ) ) )  use_a  =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! ( ! clip  | |  ( ( ( lambda  =  line_point_factor_v3 ( isect_b ,  line_a - > vec ,  line_b - > vec ) )  > =  0.0f )  & &  ( lambda  < =  1.0f ) ) ) )  use_b  =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												use_a  =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												use_b  =  FALSE ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 17:16:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 07:21:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 04:45:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( use_a )  {  PyTuple_SET_ITEM ( ret ,  0 ,   Vector_CreatePyObject ( isect_a ,  3 ,  Py_NEW ,  NULL ) ) ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-26 06:55:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else        {  PyTuple_SET_ITEM ( ret ,  0 ,   Py_None ) ;  Py_INCREF ( Py_None ) ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 07:21:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 04:45:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( use_b )  {  PyTuple_SET_ITEM ( ret ,  1 ,   Vector_CreatePyObject ( isect_b ,  3 ,  Py_NEW ,  NULL ) ) ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-26 06:55:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else        {  PyTuple_SET_ITEM ( ret ,  1 ,   Py_None ) ;  Py_INCREF ( Py_None ) ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 07:21:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 17:16:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 07:21:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 17:16:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* keep in sync with M_Geometry_intersect_line_sphere */  
						 
					
						
							
								
									
										
										
										
											2011-06-26 11:08:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_intersect_line_sphere_2d_doc ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" .. function:: intersect_line_sphere_2d(line_a, line_b, sphere_co, sphere_radius, clip=True) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Takes a lines (as 2 vectors), a sphere as a point and a radius and \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    returns the intersection \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg line_a: First point of the first line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type line_a: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg line_b: Second point of the first line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type line_b: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg sphere_co: The center of the sphere \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type sphere_co: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg sphere_radius: Radius of the sphere \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type sphere_radius: sphere_radius \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :return: The intersection points as a pair of vectors or None when there is no intersection \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: A tuple pair containing :class:`mathutils.Vector` or None \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_intersect_line_sphere_2d ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
										
											2011-06-26 11:08:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * line_a ,  * line_b ,  * sphere_co ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  sphere_radius ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  clip  =  TRUE ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 11:08:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  isect_a [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  isect_b [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!f|i:intersect_line_sphere_2d " , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									                      & vector_Type ,  & line_a , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & line_b , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & sphere_co , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & sphere_radius ,  & clip ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 11:08:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BaseMath_ReadCallback ( line_a )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( line_b )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( sphere_co )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 11:08:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 17:16:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										short  use_a  =  TRUE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										short  use_b  =  TRUE ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 17:16:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  lambda ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyObject  * ret  =  PyTuple_New ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 17:16:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-18 08:50:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										switch  ( isect_line_sphere_v2 ( line_a - > vec ,  line_b - > vec ,  sphere_co - > vec ,  sphere_radius ,  isect_a ,  isect_b ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											case  1 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! ( ! clip  | |  ( ( ( lambda  =  line_point_factor_v2 ( isect_a ,  line_a - > vec ,  line_b - > vec ) )  > =  0.0f )  & &  ( lambda  < =  1.0f ) ) ) )  use_a  =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												use_b  =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  2 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! ( ! clip  | |  ( ( ( lambda  =  line_point_factor_v2 ( isect_a ,  line_a - > vec ,  line_b - > vec ) )  > =  0.0f )  & &  ( lambda  < =  1.0f ) ) ) )  use_a  =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( ! ( ! clip  | |  ( ( ( lambda  =  line_point_factor_v2 ( isect_b ,  line_a - > vec ,  line_b - > vec ) )  > =  0.0f )  & &  ( lambda  < =  1.0f ) ) ) )  use_b  =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												use_a  =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												use_b  =  FALSE ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 17:16:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 11:08:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 04:45:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( use_a )  {  PyTuple_SET_ITEM ( ret ,  0 ,   Vector_CreatePyObject ( isect_a ,  2 ,  Py_NEW ,  NULL ) ) ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-26 06:55:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else        {  PyTuple_SET_ITEM ( ret ,  0 ,   Py_None ) ;  Py_INCREF ( Py_None ) ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 11:08:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 04:45:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( use_b )  {  PyTuple_SET_ITEM ( ret ,  1 ,   Vector_CreatePyObject ( isect_b ,  2 ,  Py_NEW ,  NULL ) ) ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-26 06:55:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else        {  PyTuple_SET_ITEM ( ret ,  1 ,   Py_None ) ;  Py_INCREF ( Py_None ) ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 11:08:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 17:16:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 11:08:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_intersect_point_line_doc ,  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" .. function:: intersect_point_line(pt, line_p1, line_p2) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Takes a point and a line and returns a tuple with the closest point on the line and its distance from the first point of the line as a percentage of the length of the line. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg pt: Point \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type pt: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg line_p1: First point of the line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type line_p1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg line_p1: Second point of the line \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type line_p1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: (:class:`mathutils.Vector`, float) \n "  
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_intersect_point_line ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * pt ,  * line_1 ,  * line_2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  pt_in [ 3 ] ,  pt_out [ 3 ] ,  l1 [ 3 ] ,  l2 [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  lambda ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PyObject  * ret ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-28 11:27:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  size  =  2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!:intersect_point_line " , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									                      & vector_Type ,  & pt , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & line_1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & line_2 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BaseMath_ReadCallback ( pt )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( line_1 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( line_2 )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-22 04:26:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									/* accept 2d verts */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-28 11:27:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( pt - > size  > =  3 )      {  copy_v3_v3 ( pt_in ,  pt - > vec ) ;  size  =  3 ;  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else                    {  copy_v2_v2 ( pt_in ,  pt - > vec ) ;  pt_in [ 2 ]  =  0.0f ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-08-28 11:27:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( line_1 - > size  > =  3 )  {  copy_v3_v3 ( l1 ,  line_1 - > vec ) ;  size  =  3 ;  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else                    {  copy_v2_v2 ( l1 ,  line_1 - > vec ) ;  l1 [ 2 ]  =  0.0f ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-08-28 11:27:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( line_2 - > size  > =  3 )  {  copy_v3_v3 ( l2 ,  line_2 - > vec ) ;  size  =  3 ;  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else                    {  copy_v2_v2 ( l2 ,  line_2 - > vec ) ;  l2 [ 2 ]  =  0.0f ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* do the calculation */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									lambda  =  closest_to_line_v3 ( pt_out ,  pt_in ,  l1 ,  l2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ret  =  PyTuple_New ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-28 11:27:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PyTuple_SET_ITEM ( ret ,  0 ,  Vector_CreatePyObject ( pt_out ,  size ,  Py_NEW ,  NULL ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PyTuple_SET_ITEM ( ret ,  1 ,  PyFloat_FromDouble ( lambda ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									return  ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_intersect_point_tri_2d_doc ,  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" .. function:: intersect_point_tri_2d(pt, tri_p1, tri_p2, tri_p3) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Takes 4 vectors (using only the x and y coordinates): one is the point and the next 3 define the triangle. Returns 1 if the point is within the triangle, otherwise 0. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg pt: Point \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type v1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg tri_p1: First point of the triangle \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type tri_p1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg tri_p2: Second point of the triangle \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type tri_p2: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg tri_p3: Third point of the triangle \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type tri_p3: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: int \n "  
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_intersect_point_tri_2d ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * pt_vec ,  * tri_p1 ,  * tri_p2 ,  * tri_p3 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!O!:intersect_point_tri_2d " , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									                      & vector_Type ,  & pt_vec , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & tri_p1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & tri_p2 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & tri_p3 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BaseMath_ReadCallback ( pt_vec )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( tri_p1 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( tri_p2 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( tri_p3 )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-22 04:26:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  PyLong_FromLong ( isect_point_tri_v2 ( pt_vec - > vec ,  tri_p1 - > vec ,  tri_p2 - > vec ,  tri_p3 - > vec ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_intersect_point_quad_2d_doc ,  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" .. function:: intersect_point_quad_2d(pt, quad_p1, quad_p2, quad_p3, quad_p4) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
									
										
										
										
											2011-12-17 00:52:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"    Takes 5 vectors (using only the x and y coordinates): one is the point and the next 4 define the quad,  \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    only the x and y are used from the vectors. Returns 1 if the point is within the quad, otherwise 0. \n "  
						 
					
						
							
								
									
										
										
										
											2012-06-06 08:08:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"    Works only with convex quads without singular edges. "  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg pt: Point \n "  
						 
					
						
							
								
									
										
										
										
											2011-11-12 10:06:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"    :type pt: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"    :arg quad_p1: First point of the quad \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type quad_p1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg quad_p2: Second point of the quad \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type quad_p2: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg quad_p3: Third point of the quad \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type quad_p3: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg quad_p4: Forth point of the quad \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type quad_p4: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: int \n "  
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_intersect_point_quad_2d ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * pt_vec ,  * quad_p1 ,  * quad_p2 ,  * quad_p3 ,  * quad_p4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!O!O!:intersect_point_quad_2d " , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									                      & vector_Type ,  & pt_vec , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & quad_p1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & quad_p2 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & quad_p3 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & quad_p4 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BaseMath_ReadCallback ( pt_vec )   = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( quad_p1 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( quad_p2 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( quad_p3 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( quad_p4 )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-22 04:26:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  PyLong_FromLong ( isect_point_quad_v2 ( pt_vec - > vec ,  quad_p1 - > vec ,  quad_p2 - > vec ,  quad_p3 - > vec ,  quad_p4 - > vec ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-12 10:06:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_distance_point_to_plane_doc ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" .. function:: distance_point_to_plane(pt, plane_co, plane_no) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Returns the signed distance between a point and a plane  "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    (negative when below the normal). \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg pt: Point \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type pt: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg plane_co: First point of the quad \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type plane_co: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg plane_no: Second point of the quad \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type plane_no: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: float \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_distance_point_to_plane ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
										
											2011-11-12 10:06:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * pt ,  * plene_co ,  * plane_no ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!:distance_point_to_plane " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & pt , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & plene_co , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									                      & vector_Type ,  & plane_no ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-12 10:06:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BaseMath_ReadCallback ( pt )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( plene_co )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( plane_no )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-12 10:06:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  PyFloat_FromDouble ( dist_to_plane_v3 ( pt - > vec ,  plene_co - > vec ,  plane_no - > vec ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_barycentric_transform_doc ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" .. function:: barycentric_transform(point, tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Return a transformed point, the transformation is defined by 2 triangles. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg point: The point to transform. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type point: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg tri_a1: source triangle vertex. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type tri_a1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg tri_a2: source triangle vertex. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type tri_a2: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg tri_a3: source triangle vertex. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type tri_a3: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg tri_a1: target triangle vertex. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type tri_a1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg tri_a2: target triangle vertex. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type tri_a2: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg tri_a3: target triangle vertex. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type tri_a3: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :return: The transformed point \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: :class:`mathutils.Vector`'s \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_barycentric_transform ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									VectorObject  * vec_pt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * vec_t1_tar ,  * vec_t2_tar ,  * vec_t3_tar ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * vec_t1_src ,  * vec_t2_src ,  * vec_t3_src ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  vec [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-03 12:11:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!O!O!O!O!:barycentric_transform " , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec_pt , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec_t1_src , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec_t2_src , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec_t3_src , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec_t1_tar , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec_t2_tar , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec_t3_tar ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( vec_pt - > size  ! =  3  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    vec_t1_src - > size  ! =  3  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    vec_t2_src - > size  ! =  3  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    vec_t3_src - > size  ! =  3  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    vec_t1_tar - > size  ! =  3  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    vec_t2_tar - > size  ! =  3  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    vec_t3_tar - > size  ! =  3 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                " One of more of the vector arguments wasn't a 3D vector " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									barycentric_transform ( vec ,  vec_pt - > vec , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-26 06:55:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									                      vec_t1_tar - > vec ,  vec_t2_tar - > vec ,  vec_t3_tar - > vec , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      vec_t1_src - > vec ,  vec_t2_src - > vec ,  vec_t3_src - > vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 04:45:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  Vector_CreatePyObject ( vec ,  3 ,  Py_NEW ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-06-27 09:51:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_points_in_planes_doc ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" .. function:: points_in_planes(planes) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Returns a list of points inside all planes given and a list of index values for the planes used. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg planes: List of planes (4D vectors). \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type planes: list of :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :return: two lists, once containing the vertices inside the planes, another containing the plane indicies used \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: pair of lists \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* note: this function could be optimized by some spatial structure */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_points_in_planes ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PyObject  * py_planes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  ( * planes ) [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									unsigned  int  planes_len ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O:points_in_planes " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & py_planes ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ( planes_len  =  mathutils_array_parse_alloc_v ( ( float  * * ) & planes ,  4 ,  py_planes ,  " points_in_planes " ) )  = =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* note, this could be refactored into plain C easy - py bits are noted */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  float  eps  =  0.0001f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										const  unsigned  int  len  =  ( unsigned  int ) planes_len ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										unsigned  int  i ,  j ,  k ,  l ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  n1n2 [ 3 ] ,  n2n3 [ 3 ] ,  n3n1 [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  potentialVertex [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										char  * planes_used  =  MEM_callocN ( sizeof ( char )  *  len ,  __func__ ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* python */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										PyObject  * py_verts  =  PyList_New ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										PyObject  * py_plene_index  =  PyList_New ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( i  =  0 ;  i  <  len ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  float  * N1  =  planes [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  ( j  =  i  +  1 ;  j  <  len ;  j + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												const  float  * N2  =  planes [ j ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												cross_v3_v3v3 ( n1n2 ,  N1 ,  N2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( len_squared_v3 ( n1n2 )  >  eps )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													for  ( k  =  j  +  1 ;  k  <  len ;  k + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														const  float  * N3  =  planes [ k ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														cross_v3_v3v3 ( n2n3 ,  N2 ,  N3 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														if  ( len_squared_v3 ( n2n3 )  >  eps )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															cross_v3_v3v3 ( n3n1 ,  N3 ,  N1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															if  ( len_squared_v3 ( n3n1 )  >  eps )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																const  float  quotient  =  dot_v3v3 ( N1 ,  n2n3 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																if  ( fabsf ( quotient )  >  eps )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	/* potentialVertex = (n2n3 * N1[3] + n3n1 * N2[3] + n1n2 * N3[3]) * (-1.0 / quotient); */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	const  float  quotient_ninv  =  - 1.0f  /  quotient ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	potentialVertex [ 0 ]  =  ( ( n2n3 [ 0 ]  *  N1 [ 3 ] )  +  ( n3n1 [ 0 ]  *  N2 [ 3 ] )  +  ( n1n2 [ 0 ]  *  N3 [ 3 ] ) )  *  quotient_ninv ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	potentialVertex [ 1 ]  =  ( ( n2n3 [ 1 ]  *  N1 [ 3 ] )  +  ( n3n1 [ 1 ]  *  N2 [ 3 ] )  +  ( n1n2 [ 1 ]  *  N3 [ 3 ] ) )  *  quotient_ninv ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	potentialVertex [ 2 ]  =  ( ( n2n3 [ 2 ]  *  N1 [ 3 ] )  +  ( n3n1 [ 2 ]  *  N2 [ 3 ] )  +  ( n1n2 [ 2 ]  *  N3 [ 3 ] ) )  *  quotient_ninv ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	for  ( l  =  0 ;  l  <  len ;  l + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																		const  float  * NP  =  planes [ l ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																		if  ( ( dot_v3v3 ( NP ,  potentialVertex )  +  NP [ 3 ] )  >  0.000001f )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																			break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																		} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	if  ( l  = =  len )  {  /* ok */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																		/* python */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																		PyObject  * item  =  Vector_CreatePyObject ( potentialVertex ,  3 ,  Py_NEW ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																		PyList_Append ( py_verts ,  item ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																		Py_DECREF ( item ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																		planes_used [ i ]  =  planes_used [ j ]  =  planes_used [ k ]  =  TRUE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																	} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
																} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										PyMem_Free ( planes ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* now make a list of used planes */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( i  =  0 ;  i  <  len ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( planes_used [ i ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												PyObject  * item  =  PyLong_FromLong ( i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												PyList_Append ( py_plene_index ,  item ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Py_DECREF ( item ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MEM_freeN ( planes_used ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											PyObject  * ret  =  PyTuple_New ( 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											PyTuple_SET_ITEM ( ret ,  0 ,  py_verts ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											PyTuple_SET_ITEM ( ret ,  1 ,  py_plene_index ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# ifndef MATH_STANDALONE 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_interpolate_bezier_doc ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" .. function:: interpolate_bezier(knot1, handle1, handle2, knot2, resolution) \n "  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"    Interpolate a bezier spline segment. \n "  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"    :arg knot1: First bezier spline point. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type knot1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg handle1: First bezier spline handle. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type handle1: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg handle2: Second bezier spline handle. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type handle2: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg knot2: Second bezier spline point. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type knot2: :class:`mathutils.Vector` \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg resolution: Number of points to return. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type resolution: int \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :return: The interpolated points \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: list of :class:`mathutils.Vector`'s \n "  
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_interpolate_bezier ( PyObject  * UNUSED ( self ) ,  PyObject  * args )  
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									VectorObject  * vec_k1 ,  * vec_h1 ,  * vec_k2 ,  * vec_h2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  resolu ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  dims ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  * coord_array ,  * fp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PyObject  * list ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  k1 [ 4 ]  =  { 0.0 ,  0.0 ,  0.0 ,  0.0 } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  h1 [ 4 ]  =  { 0.0 ,  0.0 ,  0.0 ,  0.0 } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  k2 [ 4 ]  =  { 0.0 ,  0.0 ,  0.0 ,  0.0 } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  h2 [ 4 ]  =  { 0.0 ,  0.0 ,  0.0 ,  0.0 } ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyArg_ParseTuple ( args ,  " O!O!O!O!i:interpolate_bezier " , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec_k1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec_h1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec_h2 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                      & vector_Type ,  & vec_k2 ,  & resolu ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-03 12:11:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( resolu  < =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-14 01:25:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_ValueError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                " resolution must be 2 or over " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-03 12:11:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-16 21:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( BaseMath_ReadCallback ( vec_k1 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( vec_h1 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( vec_k2 )  = =  - 1  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									    BaseMath_ReadCallback ( vec_h2 )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-22 04:26:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-13 09:38:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-03 12:11:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									dims  =  MAX4 ( vec_k1 - > size ,  vec_h1 - > size ,  vec_h2 - > size ,  vec_k2 - > size ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  vec_k1 - > size ;  i + + )  k1 [ i ]  =  vec_k1 - > vec [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  vec_h1 - > size ;  i + + )  h1 [ i ]  =  vec_h1 - > vec [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  vec_k2 - > size ;  i + + )  k2 [ i ]  =  vec_k2 - > vec [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  vec_h2 - > size ;  i + + )  h2 [ i ]  =  vec_h2 - > vec [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									coord_array  =  MEM_callocN ( dims  *  ( resolu )  *  sizeof ( float ) ,  " interpolate_bezier " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  dims ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 16:49:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_curve_forward_diff_bezier ( k1 [ i ] ,  h1 [ i ] ,  h2 [ i ] ,  k2 [ i ] ,  coord_array  +  i ,  resolu  -  1 ,  sizeof ( float )  *  dims ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									list  =  PyList_New ( resolu ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									fp  =  coord_array ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  resolu ;  i + + ,  fp  =  fp  +  dims )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-24 04:45:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyList_SET_ITEM ( list ,  i ,  Vector_CreatePyObject ( fp ,  dims ,  Py_NEW ,  NULL ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-17 20:33:34 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MEM_freeN ( coord_array ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  list ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2009-12-27 01:32:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-20 22:56:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_tessellate_polygon_doc ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" .. function:: tessellate_polygon(veclist_list) \n "  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"    Takes a list of polylines (each point a vector) and returns the point indices for a polyline filled with triangles. \n "  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"    :arg veclist_list: list of polylines \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: list \n "  
						 
					
						
							
								
									
										
										
										
											2011-05-24 16:05:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* PolyFill function, uses Blenders scanfill to fill multiple poly lines */  
						 
					
						
							
								
									
										
										
										
											2012-03-20 22:56:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_tessellate_polygon ( PyObject  * UNUSED ( self ) ,  PyObject  * polyLineSeq )  
						 
					
						
							
								
									
										
										
										
											2009-12-27 01:32:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PyObject  * tri_list ;  /*return this list of tri's */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PyObject  * polyLine ,  * polyVec ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  i ,  len_polylines ,  len_polypoints ,  ls_error  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-27 01:32:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* display listbase */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ListBase  dispbase  =  { NULL ,  NULL } ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DispList  * dl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  * fp ;  /*pointer to the array of malloced dl->verts to set the points from the vectors */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  index ,  * dl_face ,  totpoints  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PySequence_Check ( polyLineSeq ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_TypeError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                " expected a sequence of poly lines " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-27 01:32:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									len_polylines  =  PySequence_Size ( polyLineSeq ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-25 11:36:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  len_polylines ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										polyLine  =  PySequence_GetItem ( polyLineSeq ,  i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! PySequence_Check ( polyLine ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-07 06:58:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_displist_free ( & dispbase ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											Py_XDECREF ( polyLine ) ;  /* may be null so use Py_XDECREF*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											PyErr_SetString ( PyExc_TypeError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											                " One or more of the polylines is not a sequence of mathutils.Vector's " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										len_polypoints  =  PySequence_Size ( polyLine ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-18 07:38:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( len_polypoints  >  0 )  {  /* don't bother adding edges as polylines */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								#if 0 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( EXPP_check_sequence_consistency ( polyLine ,  & vector_Type )  ! =  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												freedisplist ( & dispbase ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Py_DECREF ( polyLine ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												PyErr_SetString ( PyExc_TypeError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												                " A point in one of the polylines is not a mathutils.Vector type " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											dl  =  MEM_callocN ( sizeof ( DispList ) ,  " poly disp " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BLI_addtail ( & dispbase ,  dl ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											dl - > type  =  DL_INDEX3 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											dl - > nr  =  len_polypoints ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											dl - > type  =  DL_POLY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											dl - > parts  =  1 ;  /* no faces, 1 edge loop */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											dl - > col  =  0 ;  /* no material */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											dl - > verts  =  fp  =  MEM_callocN ( sizeof ( float )  *  3  *  len_polypoints ,  " dl verts " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											dl - > index  =  MEM_callocN ( sizeof ( int )  *  3  *  len_polypoints ,  " dl index " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-25 11:36:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( index  =  0 ;  index  <  len_polypoints ;  index + + ,  fp  + =  3 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												polyVec  =  PySequence_GetItem ( polyLine ,  index ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( VectorObject_Check ( polyVec ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( BaseMath_ReadCallback ( ( VectorObject  * ) polyVec )  = =  - 1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														ls_error  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													fp [ 0 ]  =  ( ( VectorObject  * ) polyVec ) - > vec [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													fp [ 1 ]  =  ( ( VectorObject  * ) polyVec ) - > vec [ 1 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( ( ( VectorObject  * ) polyVec ) - > size  >  2 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														fp [ 2 ]  =  ( ( VectorObject  * ) polyVec ) - > vec [ 2 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													else 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-26 06:55:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														fp [ 2 ]  =  0.0f ;   /* if its a 2d vector then set the z to be zero */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													ls_error  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												totpoints + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												Py_DECREF ( polyVec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Py_DECREF ( polyLine ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ls_error )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-07 06:58:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_displist_free ( & dispbase ) ;  /* possible some dl was allocated */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_TypeError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                " A point in one of the polylines  " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                " is not a mathutils.Vector type " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-21 15:53:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( totpoints )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* now make the list to return */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-07 06:58:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_displist_fill ( & dispbase ,  & dispbase ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-03 12:11:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* The faces are stored in a new DisplayList
 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-03 20:36:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 *  thats  added  to  the  head  of  the  listbase  */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										dl  =  dispbase . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-27 01:32:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										tri_list  =  PyList_New ( dl - > parts ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! tri_list )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-07 06:58:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BKE_displist_free ( & dispbase ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											PyErr_SetString ( PyExc_RuntimeError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											                " failed to make a new list " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										index  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										dl_face  =  dl - > index ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										while  ( index  <  dl - > parts )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											PyList_SET_ITEM ( tri_list ,  index ,  Py_BuildValue ( " iii " ,  dl_face [ 0 ] ,  dl_face [ 1 ] ,  dl_face [ 2 ] ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											dl_face  + =  3 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											index + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-07 06:58:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_displist_free ( & dispbase ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-18 07:38:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* no points, do this so scripts don't barf */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-07 06:58:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BKE_displist_free ( & dispbase ) ;  /* possible some dl was allocated */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										tri_list  =  PyList_New ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  tri_list ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-27 01:32:58 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 00:23:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  boxPack_FromPyObject ( PyObject  * value ,  BoxPack  * * boxarray )  
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-09-06 23:46:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Py_ssize_t  len ,  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PyObject  * list_item ,  * item_1 ,  * item_2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 00:23:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BoxPack  * box ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* Error checking must already be done */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyList_Check ( value ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_TypeError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                " can only back a list of [x, y, w, h] " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									len  =  PyList_GET_SIZE ( value ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 00:23:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									* boxarray  =  MEM_mallocN ( len  *  sizeof ( BoxPack ) ,  " BoxPack box " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  len ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										list_item  =  PyList_GET_ITEM ( value ,  i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ! PyList_Check ( list_item )  | |  PyList_GET_SIZE ( list_item )  <  4 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											MEM_freeN ( * boxarray ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											PyErr_SetString ( PyExc_TypeError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											                " can only pack a list of [x, y, w, h] " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										box  =  ( * boxarray )  +  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										item_1  =  PyList_GET_ITEM ( list_item ,  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										item_2  =  PyList_GET_ITEM ( list_item ,  3 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										box - > w  =   ( float ) PyFloat_AsDouble ( item_1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										box - > h  =   ( float ) PyFloat_AsDouble ( item_2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										box - > index  =  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* accounts for error case too and overwrites with own error */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( box - > w  <  0.0f  | |  box - > h  <  0.0f )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											MEM_freeN ( * boxarray ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											PyErr_SetString ( PyExc_TypeError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											                " error parsing width and height values from list:  " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											                " [x, y, w, h], not numbers or below zero " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* verts will be added later */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 00:23:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  boxPack_ToPyObject ( PyObject  * value ,  BoxPack  * * boxarray )  
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-09-06 23:46:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Py_ssize_t  len ,  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PyObject  * list_item ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 00:23:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BoxPack  * box ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									len  =  PyList_GET_SIZE ( value ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  ( i  =  0 ;  i  <  len ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-25 11:36:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										box  =  ( * boxarray )  +  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										list_item  =  PyList_GET_ITEM ( value ,  box - > index ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyList_SET_ITEM ( list_item ,  0 ,  PyFloat_FromDouble ( box - > x ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										PyList_SET_ITEM ( list_item ,  1 ,  PyFloat_FromDouble ( box - > y ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MEM_freeN ( * boxarray ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								PyDoc_STRVAR ( M_Geometry_box_pack_2d_doc ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" .. function:: box_pack_2d(boxes) \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    Returns the normal of the 3D tri or quad. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								" \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :arg boxes: list of boxes, each box is a list where the first 4 items are [x, y, width, height, ...] other items are ignored. \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :type boxes: list \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :return: the width and height of the packed bounding box \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"    :rtype: tuple, pair of floats \n "  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  PyObject  * M_Geometry_box_pack_2d ( PyObject  * UNUSED ( self ) ,  PyObject  * boxlist )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  tot_width  =  0.0f ,  tot_height  =  0.0f ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-06 23:46:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Py_ssize_t  len ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PyObject  * ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! PyList_Check ( boxlist ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PyErr_SetString ( PyExc_TypeError , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										                " expected a list of boxes [[x, y, w, h], ... ] " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									len  =  PyList_GET_SIZE ( boxlist ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( len )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 00:23:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BoxPack  * boxarray  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-13 01:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( boxPack_FromPyObject ( boxlist ,  & boxarray )  = =  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  NULL ;  /* exception set */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* Non Python function */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-05 00:23:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BLI_box_pack_2D ( boxarray ,  len ,  & tot_width ,  & tot_height ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										boxPack_ToPyObject ( boxlist ,  & boxarray ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ret  =  PyTuple_New ( 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PyTuple_SET_ITEM ( ret ,  0 ,  PyFloat_FromDouble ( tot_width ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PyTuple_SET_ITEM ( ret ,  1 ,  PyFloat_FromDouble ( tot_width ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif  /* MATH_STANDALONE */ 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  PyMethodDef  M_Geometry_methods [ ]  =  {  
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ " intersect_ray_tri " ,  ( PyCFunction )  M_Geometry_intersect_ray_tri ,  METH_VARARGS ,  M_Geometry_intersect_ray_tri_doc } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ " intersect_point_line " ,  ( PyCFunction )  M_Geometry_intersect_point_line ,  METH_VARARGS ,  M_Geometry_intersect_point_line_doc } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ " intersect_point_tri_2d " ,  ( PyCFunction )  M_Geometry_intersect_point_tri_2d ,  METH_VARARGS ,  M_Geometry_intersect_point_tri_2d_doc } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ " intersect_point_quad_2d " ,  ( PyCFunction )  M_Geometry_intersect_point_quad_2d ,  METH_VARARGS ,  M_Geometry_intersect_point_quad_2d_doc } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ " intersect_line_line " ,  ( PyCFunction )  M_Geometry_intersect_line_line ,  METH_VARARGS ,  M_Geometry_intersect_line_line_doc } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ " intersect_line_line_2d " ,  ( PyCFunction )  M_Geometry_intersect_line_line_2d ,  METH_VARARGS ,  M_Geometry_intersect_line_line_2d_doc } , 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-19 04:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ " intersect_line_plane " ,  ( PyCFunction )  M_Geometry_intersect_line_plane ,  METH_VARARGS ,  M_Geometry_intersect_line_plane_doc } , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-20 05:56:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ " intersect_plane_plane " ,  ( PyCFunction )  M_Geometry_intersect_plane_plane ,  METH_VARARGS ,  M_Geometry_intersect_plane_plane_doc } , 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 07:21:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ " intersect_line_sphere " ,  ( PyCFunction )  M_Geometry_intersect_line_sphere ,  METH_VARARGS ,  M_Geometry_intersect_line_sphere_doc } , 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-26 11:08:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ " intersect_line_sphere_2d " ,  ( PyCFunction )  M_Geometry_intersect_line_sphere_2d ,  METH_VARARGS ,  M_Geometry_intersect_line_sphere_2d_doc } , 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-12 10:06:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ " distance_point_to_plane " ,  ( PyCFunction )  M_Geometry_distance_point_to_plane ,  METH_VARARGS ,  M_Geometry_distance_point_to_plane_doc } , 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ " area_tri " ,  ( PyCFunction )  M_Geometry_area_tri ,  METH_VARARGS ,  M_Geometry_area_tri_doc } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ " normal " ,  ( PyCFunction )  M_Geometry_normal ,  METH_VARARGS ,  M_Geometry_normal_doc } , 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ " barycentric_transform " ,  ( PyCFunction )  M_Geometry_barycentric_transform ,  METH_VARARGS ,  M_Geometry_barycentric_transform_doc } , 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-27 09:51:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ " points_in_planes " ,  ( PyCFunction )  M_Geometry_points_in_planes ,  METH_VARARGS ,  M_Geometry_points_in_planes_doc } , 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# ifndef MATH_STANDALONE 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ " interpolate_bezier " ,  ( PyCFunction )  M_Geometry_interpolate_bezier ,  METH_VARARGS ,  M_Geometry_interpolate_bezier_doc } , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-20 22:56:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ " tessellate_polygon " ,  ( PyCFunction )  M_Geometry_tessellate_polygon ,  METH_O ,  M_Geometry_tessellate_polygon_doc } , 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 02:11:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ " box_pack_2d " ,  ( PyCFunction )  M_Geometry_box_pack_2d ,  METH_O ,  M_Geometry_box_pack_2d_doc } , 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									{ NULL ,  NULL ,  0 ,  NULL } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  struct  PyModuleDef  M_Geometry_module_def  =  {  
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PyModuleDef_HEAD_INIT , 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-25 22:44:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									" mathutils.geometry " ,   /* m_name */ 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									M_Geometry_doc ,   /* m_doc */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									0 ,   /* m_size */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									M_Geometry_methods ,   /* m_methods */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-13 10:52:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									NULL ,   /* m_reload */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									NULL ,   /* m_traverse */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									NULL ,   /* m_clear */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									NULL ,   /* m_free */ 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/*----------------------------MODULE INIT-------------------------*/  
						 
					
						
							
								
									
										
										
										
											2011-07-15 04:01:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								PyMODINIT_FUNC  PyInit_mathutils_geometry ( void )  
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-12-24 13:26:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PyObject  * submodule  =  PyModule_Create ( & M_Geometry_module_def ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-29 22:59:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  submodule ; 
							 
						 
					
						
							
								
									
										
										
											
												Mathutils refactor & include in sphinx generated docs, (TODO, include getset'ers in docs)
 - Mathutils.MidpointVecs --> vector.lerp(other, fac)
 - Mathutils.AngleBetweenVecs --> vector.angle(other)
 - Mathutils.ProjectVecs --> vector.project(other)
 - Mathutils.DifferenceQuats --> quat.difference(other)
 - Mathutils.Slerp --> quat.slerp(other, fac)
 - Mathutils.Rand: removed, use pythons random module
 - Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
 - Matrix.scalePart --> Matrix.scale_part
 - Matrix.translationPart --> Matrix.translation_part
 - Matrix.rotationPart --> Matrix.rotation_part
 - toMatrix --> to_matrix
 - toEuler --> to_euler
 - toQuat --> to_quat
 - Vector.toTrackQuat --> Vector.to_track_quat
											 
										 
										
											2010-01-25 09:44:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}