Exemplo n.º 1
0
IoObject *IoODEMass_centerOfGravity(IoODEMass *self, IoObject *locals, IoMessage *m)
{
	vec3f v;

	v.x = DATA(self)->c[0];
	v.y = DATA(self)->c[1];
	v.z = DATA(self)->c[2];

	return IoSeq_newVec3f(IOSTATE, v);
}
Exemplo n.º 2
0
Arquivo: IoBox.c Projeto: ADTSH/io
IoBox *IoBox_proto(void *state)
{
	vec3f o = {0, 0, 0};
	IoBox *self = IoObject_new(state);
	IoObject_tag_(self, IoBox_newTag(state));

	IoObject_setDataPointer_(self, calloc(1, sizeof(IoBoxData)));

	DATA(self)->origin = IoSeq_newVec3f(state, o);
	DATA(self)->size   = IoSeq_newVec3f(state, o);

	IoState_registerProtoWithId_(state, self, protoId);

	{
		IoMethodTable methodTable[] = {
		{"set", IoBox_set},
		{"origin", IoBox_origin},
		{"size", IoBox_size},

		{"width", IoBox_width},
		{"height", IoBox_height},
		{"depth", IoBox_depth},

		{"setOrigin", IoBox_setOrigin},
		{"setSize", IoBox_setSize},
		{"Union", IoBox_Union},

		{"print", IoBox_print},
		{"containsPoint", IoBox_containsPoint},
		{"intersectsBox", IoBox_intersectsBox},
		/*
		{"asString", IoBox_asString},
		{"Min", IoBox_Min},
		{"Max", IoBox_Max},
		*/

		{"resizeBy", IoBox_resizeBy},
		{NULL, NULL},
		};
		IoObject_addMethodTable_(self, methodTable);
	}
	return self;
}
Exemplo n.º 3
0
IoObject *IoImage_averageColor(IoImage *self, IoObject *locals, IoMessage *m)
{
	/*doc Image averageColor
	Returns the average RGB color of all pixels in the image. 
	*/
	
	ColorStruct c = Image_averageColor(DATA(self)->image);
	vec3f v;
	
	v.x = c.r;
	v.y = c.g;
	v.z = c.b;
	
	return IoSeq_newVec3f(IOSTATE, v);
}