Example #1
0
//-----------------------------------------------------------------------------
void StamFluidSolver::project ( float * u, float * v, float * p, float * div )
{
    int L = kds_min(_NX, _NY); // NOTE: This used to use N when we had symmetric grids
    float h = 1.0f/L; // TODO: Can include the * -0.5f as part of h.
    h *= 0.5;

    for (int j=1; j < _NY-1; j++ )
        for (int i=1; i < _NX-1; i++ )
        {
            div[IX(i,j)] = -h*(u[IX(i+1,j)]-u[IX(i-1,j)]+v[IX(i,j+1)]-v[IX(i,j-1)]);
            p[IX(i,j)] = 0;
        }
    setBound ( 0, div );
    setBound ( 0, p );

    linearSolve ( 0, p, div, 1, 4 );

    float LL = 0.5f*L;
    // TODO: Can precalculate L*0.5f
    for (int j=1; j < _NY-1; j++ )
        for (int i=1; i < _NX-1; i++ )
        {
            u[IX(i,j)] -= LL*(p[IX(i+1,j)]-p[IX(i-1,j)]);
            v[IX(i,j)] -= LL*(p[IX(i,j+1)]-p[IX(i,j-1)]);
        }
    setBound ( 1, u );
    setBound ( 2, v );
}
Example #2
0
void faceThread::setAnger()
{
    setChangeSpeed(0.3);
    setBound(0,4);
    facesketch->setAngery();
    facesketch->setMoveEyeBall(false);
}
Example #3
0
void faceThread::setSmile()
{
    setChangeSpeed(0.6);
    setBound(0,6);
    facesketch->setLovely();
    facesketch->setMoveEyeBall(false);
}
ZLTextSelectionModel::ExtensionResult ZLTextSelectionModel::extendTo(int x, int y) {
	if (!myIsActive || myArea.myTextElementMap.empty()) {
		return BOUND_NOT_CHANGED;
	}

	Range oldRange = internalRange();
	setBound(mySecondBound, x, y);
	Range newRange = internalRange();
	myStoredX = x;
	myStoredY = y;

	ExtensionResult result = BOUND_NOT_CHANGED;
	if ((oldRange.first != newRange.first) || (oldRange.second != newRange.second)) {
		myTextIsUpToDate = false;
		clearData();
		myRangeVectorIsUpToDate = false;
		myRanges.clear();
		copySelectionToClipboard(ZLDialogManager::CLIPBOARD_SELECTION);
		result = BOUND_CHANGED;
	}

	if (!mySecondBound.Before.Exists) {
		return BOUND_OVER_BEFORE;
	} else if (!mySecondBound.After.Exists) {
		return BOUND_OVER_AFTER;
	}

	return result;
}
Example #5
0
void faceThread::setSleep()
{
    setChangeSpeed(0.1);
    setBound(-1,0.4);
    facesketch->setNormal();
    facesketch->setMoveEyeBall(false);
}
bool ZLTextSelectionModel::extendTo(int x, int y) {
	if (!myIsActive || myView.myTextElementMap.empty()) {
		return false;
	}

	Range oldRange = internalRange();
	setBound(mySecondBound, x, y);
	Range newRange = internalRange();
	myStoredX = x;
	myStoredY = y;

	if (!mySecondBound.Before.Exists) {
		startSelectionScrolling(false);
	} else if (!mySecondBound.After.Exists) {
		startSelectionScrolling(true);
	} else {
		stopSelectionScrolling();
	}

	if ((oldRange.first != newRange.first) || (oldRange.second != newRange.second)) {
		myTextIsUpToDate = false;
		clearData();
		myRangeVectorIsUpToDate = false;
		myRanges.clear();
		return true;
	}
	return false;
}
Example #7
0
//-----------------------------------------------------------------------------
void StamFluidSolver::advect ( int b, float * d, float * d0, float * u, float * v, float dt )
{
    int i0, j0, i1, j1;
    float s0, t0, s1, t1;

    int L = kds_min(_NX, _NY); // NOTE: This used to use N when we had symmetric grids

    float dt0 = dt*L;
    for (int j=0; j < _NY-1; j++ )
        for (int i=0; i < _NX-1; i++ )
        {
            float x = i-dt0*u[IX(i,j)];
            float y = j-dt0*v[IX(i,j)];
            if (x<0.5f)
                x=0.5f;
            if (x>_NX-1-0.5f)
                x=_NX-1-0.5f;
            i0=(int)x;
            i1=i0+1;
            if (y<0.5f)
                y=0.5f;
            if (y>_NY-1-0.5f)
                y=_NY-1-0.5f;
            j0=(int)y;
            j1=j0+1;
            s1 = x-i0;
            s0 = 1.0f-s1;
            t1 = y-j0;
            t0 = 1.0f-t1;
            d[IX(i,j)] = s0*(t0*d0[IX(i0,j0)]+t1*d0[IX(i0,j1)])+
                         s1*(t0*d0[IX(i1,j0)]+t1*d0[IX(i1,j1)]);
        }
    setBound ( b, d );
}
Example #8
0
void faceThread::setTrack()
{
    setChangeSpeed(0);
    setBound(0,0.8);
    facesketch->setNormal();
    facesketch->setMoveEyeBall(true);
}
inline
int
NdbIndexScanOperation::setBound(Uint32 anAttrId, int type, const void* value,
                                Uint32 len)
{
  (void)len;  // unused
  return setBound(anAttrId, type, value);
}
inline
int
NdbIndexScanOperation::setBound(const char* attr, int type, const void* value,
                                Uint32 len)
{
  (void)len;  // unused
  return setBound(attr, type, value);
}
void ZLTextSelectionModel::update() {
	if (myIsValid) {
		return;
	}
	myIsValid = true;
	setBound(mySecondBound, myStoredX, myStoredY);
	copySelectionToClipboard(ZLDialogManager::CLIPBOARD_SELECTION);
	myTextIsUpToDate = false;
	clearData();
	myRangeVectorIsUpToDate = false;
	myRanges.clear();
}
Example #12
0
void ZLTextSelectionModel::update() {
	if (!myView.isSelectionEnabled()) {
		clear();
	} else if (myDoUpdate) {
		myDoUpdate = false;
		setBound(mySecondBound, myStoredX, myStoredY);
		myView.copySelectedTextToClipboard(ZLDialogManager::CLIPBOARD_SELECTION);
		myTextIsUpToDate = false;
		clearData();
		myRangeVectorIsUpToDate = false;
		myRanges.clear();
	}
}
Example #13
0
//-----------------------------------------------------------------------------
void StamFluidSolver::linearSolve ( int b, float * x, float * x0, float a, float c )
{
    // NOTE that I don't use linear solve in the new code

    for (int k=0 ; k<6 ; k++ )
    {
        for (int j=1 ; j < _NY-1 ; j++ ) {
            for (int i=1 ; i < _NX-1; i++ )
            {
                x[IX(i,j)] = (x0[IX(i,j)] + a*(x[IX(i-1,j)]+x[IX(i+1,j)]+x[IX(i,j-1)]+x[IX(i,j+1)]))/c;
            }
        }
        setBound ( b, x );
    }
}
void ZLTextSelectionModel::activate(int x, int y) {
	if (myArea.myTextElementMap.empty()) {
		return;
	}

	myIsActive = true;
	myIsEmpty = false;
	setBound(myFirstBound, x, y);
	mySecondBound = myFirstBound;
	myCursors.clear();
	clearData();
	myTextIsUpToDate = true;
	myRanges.clear();
	myRangeVectorIsUpToDate = true;
}
Example #15
0
	VolumeRegion::VolumeRegion()
	{
		//width = 1.0f;
		//m_bound.maxPoint = Vector( 0.0f );
		//m_bound.minPoint = Vector( 1.0f );

		//m_sigma_s = 1.0f;
		//m_sigma_t = m_sigma_s+Color(3.0); // extinction coefficient


		m_sigma_t = 5.0f;
		m_albedo = 1.0;
		m_sigma_s = m_albedo*m_sigma_t;
		m_sigma_e = 0.0f; // emission coefficient

		width = 0.2f;
		setBound( BBox( Vector( 0.15f, 0.0001f, width*0.5f ), Vector( 0.15f+width, width, -width*0.5f ) ) );
	}
Example #16
0
bool 
SocketWrapper::bind(
    const struct sockaddr *saddr, 
    socklen_t addrlen)
{
    if (!saddr) {
        return false;
    }

    if (isBound()) {
        HAGGLE_ERR("Already bound.\n");
        return false;
    }

    if (::bind(sock, saddr, addrlen) == SOCKET_ERROR) {
        HAGGLE_ERR("Could not bind socket: %s\n", 
                    STRERROR(ERRNO));
        return false;
    }

    setBound(true);

    return true;
}
void IGUIElement::load(io::IAttributeExchangingObject* aeo) throw(CIOException)
{
	setIsVisible(aeo->getBoolean(VISIBLE_ATTR));
	setBound(aeo->getRectangle(BOUND_ATTR));
	setState((EELEMENT_STATE)aeo->getInteger(STATE_ATTR));
}
Example #18
0
	/// Constructor
	/// Specify xyz location, height, and base
	Building(float x, float y, float z, float h, float b) :
		Geometry(x, y, z), height(h), base(b) {
		setBound(b/2);
	}
Example #19
0
unsigned LAVar::setLowerBound( const Real & v )
{
  return setBound( v, false );
}
Example #20
0
unsigned LAVar::setUpperBound( const Real & v )
{
  return setBound( v, true );
}