@@ -28,14 +28,154 @@ PyDoc_STRVAR(distance_docstr,
2828PyGLM_MAKE_GLM_FUNC_NN_VV__tfF (distance )
2929
3030PyDoc_STRVAR (dot_docstr ,
31- "dot(x: float , y: float ) -> float\n"
31+ "dot(x: number , y: number ) -> float\n"
3232 " Returns the dot product of `x` and `y`, i.e., `result = x * y`.\n"
33- "dot(x: vecN, y: vecN) -> float \n"
33+ "dot(x: vecN, y: vecN) -> number \n"
3434 " Returns the dot product of `x` and `y`, i.e., `result = x[0] * y[0] + x[1] * y[1] + ...`\n"
3535 "dot(x: quat, y: quat) -> float\n"
3636 " Returns dot product of `x` and `y`, i.e., `x[0] * y[0] + x[1] * y[1] + ...`"
3737);
38- PyGLM_MAKE_GLM_FUNC_NN_VV_QQ__tfF (dot )
38+
39+ static PyObject *
40+ dot_ (PyObject * , PyObject * args ) {
41+ PyObject * arg1 , * arg2 ;
42+ PyGLM_Arg_Unpack_2O (args , "dot" , arg1 , arg2 );
43+ if (PyGLM_Number_Check (arg1 ) && PyGLM_Number_Check (arg2 )) {
44+ return pack (glm ::custom ::dot (PyGLM_Number_FromPyObject < double > (arg1 ), PyGLM_Number_FromPyObject < double > (arg2 )));
45+ }
46+ PyGLM_PTI_Init0 (arg1 , PyGLM_T_VEC | PyGLM_T_QUA | PyGLM_SHAPE_ALL | PyGLM_DT_FD | PyGLM_DT_I );
47+ PyGLM_PTI_Init1 (arg2 , PyGLM_T_VEC | PyGLM_T_QUA | PyGLM_SHAPE_ALL | PyGLM_DT_FD | PyGLM_DT_I );
48+ if (PyGLM_PTI_IsVec (0 )) {
49+ if (PyGLM_Vec_PTI_Check0 (1 , float , arg1 ) && PyGLM_Vec_PTI_Check1 (1 , float , arg2 )) {
50+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (1 , float , arg1 ), PyGLM_Vec_PTI_Get1 (1 , float , arg2 )));
51+ }
52+ if (PyGLM_Vec_PTI_Check0 (1 , double , arg1 ) && PyGLM_Vec_PTI_Check1 (1 , double , arg2 )) {
53+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (1 , double , arg1 ), PyGLM_Vec_PTI_Get1 (1 , double , arg2 )));
54+ }
55+ if (PyGLM_Vec_PTI_Check0 (1 , int32 , arg1 ) && PyGLM_Vec_PTI_Check1 (1 , int32 , arg2 )) {
56+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (1 , int32 , arg1 ), PyGLM_Vec_PTI_Get1 (1 , int32 , arg2 )));
57+ }
58+ if (PyGLM_Vec_PTI_Check0 (1 , uint32 , arg1 ) && PyGLM_Vec_PTI_Check1 (1 , uint32 , arg2 )) {
59+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (1 , uint32 , arg1 ), PyGLM_Vec_PTI_Get1 (1 , uint32 , arg2 )));
60+ }
61+ if (PyGLM_Vec_PTI_Check0 (1 , int64 , arg1 ) && PyGLM_Vec_PTI_Check1 (1 , int64 , arg2 )) {
62+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (1 , int64 , arg1 ), PyGLM_Vec_PTI_Get1 (1 , int64 , arg2 )));
63+ }
64+ if (PyGLM_Vec_PTI_Check0 (1 , uint64 , arg1 ) && PyGLM_Vec_PTI_Check1 (1 , uint64 , arg2 )) {
65+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (1 , uint64 , arg1 ), PyGLM_Vec_PTI_Get1 (1 , uint64 , arg2 )));
66+ }
67+ if (PyGLM_Vec_PTI_Check0 (1 , int16 , arg1 ) && PyGLM_Vec_PTI_Check1 (1 , int16 , arg2 )) {
68+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (1 , int16 , arg1 ), PyGLM_Vec_PTI_Get1 (1 , int16 , arg2 )));
69+ }
70+ if (PyGLM_Vec_PTI_Check0 (1 , uint16 , arg1 ) && PyGLM_Vec_PTI_Check1 (1 , uint16 , arg2 )) {
71+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (1 , uint16 , arg1 ), PyGLM_Vec_PTI_Get1 (1 , uint16 , arg2 )));
72+ }
73+ if (PyGLM_Vec_PTI_Check0 (1 , int8 , arg1 ) && PyGLM_Vec_PTI_Check1 (1 , int8 , arg2 )) {
74+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (1 , int8 , arg1 ), PyGLM_Vec_PTI_Get1 (1 , int8 , arg2 )));
75+ }
76+ if (PyGLM_Vec_PTI_Check0 (1 , uint8 , arg1 ) && PyGLM_Vec_PTI_Check1 (1 , uint8 , arg2 )) {
77+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (1 , uint8 , arg1 ), PyGLM_Vec_PTI_Get1 (1 , uint8 , arg2 )));
78+ }
79+ if (PyGLM_Vec_PTI_Check0 (2 , float , arg1 ) && PyGLM_Vec_PTI_Check1 (2 , float , arg2 )) {
80+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (2 , float , arg1 ), PyGLM_Vec_PTI_Get1 (2 , float , arg2 )));
81+ }
82+ if (PyGLM_Vec_PTI_Check0 (2 , double , arg1 ) && PyGLM_Vec_PTI_Check1 (2 , double , arg2 )) {
83+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (2 , double , arg1 ), PyGLM_Vec_PTI_Get1 (2 , double , arg2 )));
84+ }
85+ if (PyGLM_Vec_PTI_Check0 (2 , int32 , arg1 ) && PyGLM_Vec_PTI_Check1 (2 , int32 , arg2 )) {
86+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (2 , int32 , arg1 ), PyGLM_Vec_PTI_Get1 (2 , int32 , arg2 )));
87+ }
88+ if (PyGLM_Vec_PTI_Check0 (2 , uint32 , arg1 ) && PyGLM_Vec_PTI_Check1 (2 , uint32 , arg2 )) {
89+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (2 , uint32 , arg1 ), PyGLM_Vec_PTI_Get1 (2 , uint32 , arg2 )));
90+ }
91+ if (PyGLM_Vec_PTI_Check0 (2 , int64 , arg1 ) && PyGLM_Vec_PTI_Check1 (2 , int64 , arg2 )) {
92+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (2 , int64 , arg1 ), PyGLM_Vec_PTI_Get1 (2 , int64 , arg2 )));
93+ }
94+ if (PyGLM_Vec_PTI_Check0 (2 , uint64 , arg1 ) && PyGLM_Vec_PTI_Check1 (2 , uint64 , arg2 )) {
95+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (2 , uint64 , arg1 ), PyGLM_Vec_PTI_Get1 (2 , uint64 , arg2 )));
96+ }
97+ if (PyGLM_Vec_PTI_Check0 (2 , int16 , arg1 ) && PyGLM_Vec_PTI_Check1 (2 , int16 , arg2 )) {
98+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (2 , int16 , arg1 ), PyGLM_Vec_PTI_Get1 (2 , int16 , arg2 )));
99+ }
100+ if (PyGLM_Vec_PTI_Check0 (2 , uint16 , arg1 ) && PyGLM_Vec_PTI_Check1 (2 , uint16 , arg2 )) {
101+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (2 , uint16 , arg1 ), PyGLM_Vec_PTI_Get1 (2 , uint16 , arg2 )));
102+ }
103+ if (PyGLM_Vec_PTI_Check0 (2 , int8 , arg1 ) && PyGLM_Vec_PTI_Check1 (2 , int8 , arg2 )) {
104+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (2 , int8 , arg1 ), PyGLM_Vec_PTI_Get1 (2 , int8 , arg2 )));
105+ }
106+ if (PyGLM_Vec_PTI_Check0 (2 , uint8 , arg1 ) && PyGLM_Vec_PTI_Check1 (2 , uint8 , arg2 )) {
107+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (2 , uint8 , arg1 ), PyGLM_Vec_PTI_Get1 (2 , uint8 , arg2 )));
108+ }
109+ if (PyGLM_Vec_PTI_Check0 (3 , float , arg1 ) && PyGLM_Vec_PTI_Check1 (3 , float , arg2 )) {
110+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (3 , float , arg1 ), PyGLM_Vec_PTI_Get1 (3 , float , arg2 )));
111+ }
112+ if (PyGLM_Vec_PTI_Check0 (3 , double , arg1 ) && PyGLM_Vec_PTI_Check1 (3 , double , arg2 )) {
113+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (3 , double , arg1 ), PyGLM_Vec_PTI_Get1 (3 , double , arg2 )));
114+ }
115+ if (PyGLM_Vec_PTI_Check0 (3 , int32 , arg1 ) && PyGLM_Vec_PTI_Check1 (3 , int32 , arg2 )) {
116+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (3 , int32 , arg1 ), PyGLM_Vec_PTI_Get1 (3 , int32 , arg2 )));
117+ }
118+ if (PyGLM_Vec_PTI_Check0 (3 , uint32 , arg1 ) && PyGLM_Vec_PTI_Check1 (3 , uint32 , arg2 )) {
119+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (3 , uint32 , arg1 ), PyGLM_Vec_PTI_Get1 (3 , uint32 , arg2 )));
120+ }
121+ if (PyGLM_Vec_PTI_Check0 (3 , int64 , arg1 ) && PyGLM_Vec_PTI_Check1 (3 , int64 , arg2 )) {
122+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (3 , int64 , arg1 ), PyGLM_Vec_PTI_Get1 (3 , int64 , arg2 )));
123+ }
124+ if (PyGLM_Vec_PTI_Check0 (3 , uint64 , arg1 ) && PyGLM_Vec_PTI_Check1 (3 , uint64 , arg2 )) {
125+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (3 , uint64 , arg1 ), PyGLM_Vec_PTI_Get1 (3 , uint64 , arg2 )));
126+ }
127+ if (PyGLM_Vec_PTI_Check0 (3 , int16 , arg1 ) && PyGLM_Vec_PTI_Check1 (3 , int16 , arg2 )) {
128+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (3 , int16 , arg1 ), PyGLM_Vec_PTI_Get1 (3 , int16 , arg2 )));
129+ }
130+ if (PyGLM_Vec_PTI_Check0 (3 , uint16 , arg1 ) && PyGLM_Vec_PTI_Check1 (3 , uint16 , arg2 )) {
131+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (3 , uint16 , arg1 ), PyGLM_Vec_PTI_Get1 (3 , uint16 , arg2 )));
132+ }
133+ if (PyGLM_Vec_PTI_Check0 (3 , int8 , arg1 ) && PyGLM_Vec_PTI_Check1 (3 , int8 , arg2 )) {
134+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (3 , int8 , arg1 ), PyGLM_Vec_PTI_Get1 (3 , int8 , arg2 )));
135+ }
136+ if (PyGLM_Vec_PTI_Check0 (3 , uint8 , arg1 ) && PyGLM_Vec_PTI_Check1 (3 , uint8 , arg2 )) {
137+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (3 , uint8 , arg1 ), PyGLM_Vec_PTI_Get1 (3 , uint8 , arg2 )));
138+ }
139+ if (PyGLM_Vec_PTI_Check0 (4 , float , arg1 ) && PyGLM_Vec_PTI_Check1 (4 , float , arg2 )) {
140+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (4 , float , arg1 ), PyGLM_Vec_PTI_Get1 (4 , float , arg2 )));
141+ }
142+ if (PyGLM_Vec_PTI_Check0 (4 , double , arg1 ) && PyGLM_Vec_PTI_Check1 (4 , double , arg2 )) {
143+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (4 , double , arg1 ), PyGLM_Vec_PTI_Get1 (4 , double , arg2 )));
144+ }
145+ if (PyGLM_Vec_PTI_Check0 (4 , int32 , arg1 ) && PyGLM_Vec_PTI_Check1 (4 , int32 , arg2 )) {
146+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (4 , int32 , arg1 ), PyGLM_Vec_PTI_Get1 (4 , int32 , arg2 )));
147+ }
148+ if (PyGLM_Vec_PTI_Check0 (4 , uint32 , arg1 ) && PyGLM_Vec_PTI_Check1 (4 , uint32 , arg2 )) {
149+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (4 , uint32 , arg1 ), PyGLM_Vec_PTI_Get1 (4 , uint32 , arg2 )));
150+ }
151+ if (PyGLM_Vec_PTI_Check0 (4 , int64 , arg1 ) && PyGLM_Vec_PTI_Check1 (4 , int64 , arg2 )) {
152+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (4 , int64 , arg1 ), PyGLM_Vec_PTI_Get1 (4 , int64 , arg2 )));
153+ }
154+ if (PyGLM_Vec_PTI_Check0 (4 , uint64 , arg1 ) && PyGLM_Vec_PTI_Check1 (4 , uint64 , arg2 )) {
155+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (4 , uint64 , arg1 ), PyGLM_Vec_PTI_Get1 (4 , uint64 , arg2 )));
156+ }
157+ if (PyGLM_Vec_PTI_Check0 (4 , int16 , arg1 ) && PyGLM_Vec_PTI_Check1 (4 , int16 , arg2 )) {
158+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (4 , int16 , arg1 ), PyGLM_Vec_PTI_Get1 (4 , int16 , arg2 )));
159+ }
160+ if (PyGLM_Vec_PTI_Check0 (4 , uint16 , arg1 ) && PyGLM_Vec_PTI_Check1 (4 , uint16 , arg2 )) {
161+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (4 , uint16 , arg1 ), PyGLM_Vec_PTI_Get1 (4 , uint16 , arg2 )));
162+ }
163+ if (PyGLM_Vec_PTI_Check0 (4 , int8 , arg1 ) && PyGLM_Vec_PTI_Check1 (4 , int8 , arg2 )) {
164+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (4 , int8 , arg1 ), PyGLM_Vec_PTI_Get1 (4 , int8 , arg2 )));
165+ }
166+ if (PyGLM_Vec_PTI_Check0 (4 , uint8 , arg1 ) && PyGLM_Vec_PTI_Check1 (4 , uint8 , arg2 )) {
167+ return pack (glm ::custom ::dot (PyGLM_Vec_PTI_Get0 (4 , uint8 , arg1 ), PyGLM_Vec_PTI_Get1 (4 , uint8 , arg2 )));
168+ }
169+ }
170+ if (PyGLM_Qua_PTI_Check0 (float , arg1 ) && PyGLM_Qua_PTI_Check1 (float , arg2 )) {
171+ return pack (glm ::custom ::dot (PyGLM_Qua_PTI_Get0 (float , arg1 ), PyGLM_Qua_PTI_Get1 (float , arg2 )));
172+ }
173+ if (PyGLM_Qua_PTI_Check0 (double , arg1 ) && PyGLM_Qua_PTI_Check1 (double , arg2 )) {
174+ return pack (glm ::custom ::dot (PyGLM_Qua_PTI_Get0 (double , arg1 ), PyGLM_Qua_PTI_Get1 (double , arg2 )));
175+ }
176+ PyGLM_TYPEERROR_2O ("invalid argument type(s) for dot(): " , arg1 , arg2 );
177+ return NULL ;
178+ }
39179
40180PyDoc_STRVAR (cross_docstr ,
41181 "cross(x: vec3, y: vec3) -> vec3\n"
0 commit comments