void TestLocalXform::testComparisonOperators() { USING_NK_NS USING_NKHIVE_NS LocalXform xform(vec3d(0.1, 0.2, 0.3)); LocalXform xform2(vec3d(0.1, 0.2, 0.3)); LocalXform xform3(vec3d(0.1, 0.1, 0.1)); CPPUNIT_ASSERT(xform == xform2); CPPUNIT_ASSERT(xform != xform3); CPPUNIT_ASSERT(xform2 != xform3); CPPUNIT_ASSERT(xform3 != xform); }
/** * Determine if the current hitpoint is on a foreground or background * tile. * * PARAMETERS: * obj - tplane object * * RETURNS: * 0 for background and 1 for foreground */ int tp_select(obj_t *obj) { plane_t *plane = (plane_t *)obj->priv; // plane struct tplane_t *tplane = (tplane_t *)plane->priv; // tplane struct double *newhit = (double *)alloca(sizeof(double) * 3); vec_diff3(plane->point, obj->hitloc, newhit); xform3(tplane->rotmat, newhit, newhit); // HACK! the 1000 is to take care of rouding error near boundries int relx = (int) (1000 + newhit[0] / tplane->size[0]); int rely = (int) (1000 + newhit[1] / tplane->size[1]); int total = relx + rely; #ifdef DEBUG_TPLANE fprintf(stderr, "relx = %d, rely = %d, mod = %d\n", relx, rely, total % 2); #endif return total % 2; }