MCPcopy Create free account
hub / github.com/carbonengine/trinity / Coercion

Method Coercion

trinity/TriVector.cpp:171–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169
170
171void TriVector::Coercion(
172 PyObject* from,
173 PyObject** to )
174{
175 // check for None first - never coerce this type! <halldor 2006.07.13>
176 if( from == Py_None )
177 {
178 return;
179 }
180
181 // convert from any standard numeric value
182 PyObject* pyfloat = PyNumber_Float( from );
183
184 if( !pyfloat )
185 return;
186
187 float f = (float)PyFloat_AS_DOUBLE( pyfloat );
188 Py_DECREF( pyfloat );
189
190 // the return value
191 ITriVectorPtr vec;
192 vec.Attach( new OTriVector );
193 vec->SetXYZ( f, f, f );
194 *to = PyOS->WrapBlueObject( vec );
195}
196#endif
197
198

Callers

nothing calls this directly

Calls 2

SetXYZMethod · 0.80
AttachMethod · 0.45

Tested by

no test coverage detected