void AdvancedBox::calculate(const Int2& parPos, const Int2& parSize, const Int2& parHotSpot, float angleDegrees, int xTopDeformation, int xBottomDeformation) { float angleRadians = angleDegrees * MathUtils::PI / 180.0f; data[0] = getRotatedPoint( parPos.x() + parSize.width() - parHotSpot.x(), parPos.y() + parSize.height() - parHotSpot.y(), angleRadians, parPos.x()/*-1*/, parPos.y(), xBottomDeformation); data[1] = getRotatedPoint( parPos.x() - parHotSpot.x(), parPos.y() + parSize.height() - parHotSpot.y(), angleRadians, parPos.x(), parPos.y(), xBottomDeformation); data[2] = getRotatedPoint( parPos.x() - parHotSpot.x(), parPos.y() - parHotSpot.y(), angleRadians, parPos.x(), parPos.y(), xTopDeformation); data[3] = getRotatedPoint( parPos.x() + parSize.width() - parHotSpot.x(), parPos.y() - parHotSpot.y(), angleRadians, parPos.x()/*-1*/, parPos.y(), xTopDeformation); /*PrintValue(data[0]); PrintValue(data[1]); PrintValue(data[2]); PrintValue(data[3]); Print("");*/ }
Point *SpaceShip::getPositions() { Point *bottomPoints = new Point[4]; bottomPoints[0] = getRotatedPoint(x + startX + 10, startY + y); bottomPoints[1] = getRotatedPoint(x + startX + 39, startY + y); bottomPoints[2] = getRotatedPoint(x + startX + 68, startY + y); bottomPoints[3] = getRotatedPoint(x + startX + 39, startY + y + shipHeight); return bottomPoints; }
void findPointIndicesInGrid( int * ind, float * pointP1, float * spacing, float * x0y0z0,float * rotMat){ /* Convert coordinates of a rotated point to indices in a grid */ float p1IECF[3]; getRotatedPoint( p1IECF , pointP1, rotMat); ind[0] = round( (p1IECF[1]-x0y0z0[1])/spacing[1]);// y IEC Fixed is along the frame axis ind[1] = round( (p1IECF[2]-x0y0z0[2])/spacing[2]);// z IEC Fixed -> rows ind[2] = round( (p1IECF[0]-x0y0z0[0])/spacing[0]); }