Example #1
0
//------------------------------------------------------------
particle::particle(){
	setInitialCondition(ofGetWidth()/2,ofGetHeight()/2,0,0);
	damping = 0.08f;
    
    
    ofSetRectMode(OF_RECTMODE_CENTER); // center around the position
    
	ofSetCircleResolution(100);
	
	
	creatureScale = .15;
    
	//store in default points for when creature is at rest
	lowerBoundaryDefault.set(175,200);
    
	//control points are stored as differences from related points (either origin or lowerBound) not absolute points
	topHandleDefault.set(72,0);
	midHandleDefault.set(-26,-133);
	lowHandleDefault.set(-155, -34);
	
	
    
	justX.set(1,0);
	justY.set(0,1);
	bothXandY.set(1,1);
    
    
    
}
Example #2
0
void
AddVariableAction::act()
{
  if (_current_action == "add_variable")
  {
    // Get necessary data for creating a variable
    std::string var_name = getShortName();
    std::set<SubdomainID> blocks = getSubdomainIDs();
    Real scale_factor = isParamValid("scaling") ? getParam<Real>("scaling") : 1;

    // Scalar variable
    if (_scalar_var)
      _problem->addScalarVariable(var_name, _fe_type.order, scale_factor);

    // Block restricted variable
    else if (blocks.empty())
      _problem->addVariable(var_name, _fe_type, scale_factor);

    // Non-block restricted variable
    else
      _problem->addVariable(var_name, _fe_type, scale_factor, &blocks);

    if (getParam<bool>("eigen"))
    {
      EigenSystem & esys(static_cast<EigenSystem &>(_problem->getNonlinearSystem()));
      esys.markEigenVariable(var_name);
    }
  }

  // Set the initial condition
  if (_current_action == "add_ic")
    setInitialCondition();
}
Example #3
0
void
AddAuxVariableAction::act()
{
  if (_current_task == "add_aux_variable")
  {
    // Name of variable being added
    std::string var_name = getShortName();

    // Blocks from the input
    std::set<SubdomainID> blocks = getSubdomainIDs();

    // Scalar variable
    if (_scalar_var)
      _problem->addAuxScalarVariable(var_name, _fe_type.order);

    // Non-scalar variable
    else
    {
      // Check that the order is valid (CONSTANT, FIRST, or SECOND)
      if (_fe_type.order > 9)
        mooseError("Non-scalar AuxVariables must be CONSTANT, FIRST, SECOND, THIRD, FOURTH, FIFTH, SIXTH, SEVENTH, EIGHTH or NINTH order (" << _fe_type.order << " supplied)");

      if (blocks.empty())
        _problem->addAuxVariable(var_name, _fe_type);
      else
        _problem->addAuxVariable(var_name, _fe_type, &blocks);
    }
  }

  // Create the initial condition
  if (_current_task == "add_ic")
    setInitialCondition();
}
Example #4
0
int main() {
  double dr = 1.0 / (double) R;
  double dt = 0.0001;
  double mu = 0.5 * dt / (dr*dr);
  int i = 0;
  
  double U[(R+1)*(R+1)];
  double b[(R+1)*(R+1)];

  double du[R];
  double dc[R+1];
  double dl[R];

  printf("mu = %.5lf\n", mu);
  
  setInitialCondition(U, (R+1), (R+1), dr);
  setA(du, dc, dl, (R+1), (R+1), mu);
  dumpMatrix(U, (R+1), (R+1), dr, 0);

  while (i++ < 5) {
    diffuse(U, b, (R+1), (R+1), du, dc, dl, mu);
    dumpMatrix(U, (R+1), (R+1), dr, i);
  }
  
}
Example #5
0
Particles::Particles(){
	//Every Particle needs the following
	
	frc = 0;		// force or acceleration 
	vel = ofPoint(x, y);

	initSize = .9;			// an initial size 
	mass = 1.0;				// a mass	
	time = 200.0;			// timer for lifetime	
	damping = 0.05f;		// adds back lost velocity

	randmin = -HALF_PI;
	randmax = 0;
	
	radius = ofRandom(-TWO_PI, TWO_PI);
	x = cos(radius);
	y = -sin(radius);
	
	radius = ofRandom(randmin, randmax);
	q = ofRandom(-1, 1);
	x = cos(radius) * q;
	y = sin(radius) * q;
	
	r = 250;
	g = 250;
	b = 250;
	a = time;
	
	counter = 0;

	setInitialCondition(0,0,0,0);

}
Example #6
0
//------------------------------------------------------------
particle::particle(){
	setInitialCondition(0,0,0,0);
	damping = 0.12f;
	bFixed = false;
	
	lastUpdateTime = ofGetElapsedTimef();
	
}
Example #7
0
//------------------------------------------------------------
particle::particle(){
	setInitialCondition(0,0,0,0);
	damping = 0.08f;

    age = 0;
    lifespan = floor( ofRandom(50,100) );
	dead = false;
}
Example #8
0
//------------------------------------------------------------
particle::particle(ofVec2f pos, ofVec2f vel) {
	setInitialCondition(pos.x, pos.y, vel.x, vel.y);
	damping = 0.08f;
	
    age = 0;
    lifespan = floor( ofRandom(10,40) );
	dead = false;
}
//------------------------------------------------------------
particle::particle(){
     ofSetCircleResolution(100);
	setInitialCondition(0,0,0,0);
	damping = 0.01f; //amortiguacion f - float number
    
    onoff = false;

}
Example #10
0
//------------------------------------------------------------
particle::particle(){
	setInitialCondition(0,0,0,0);
	damping = 0.08f;
    size = 8;
    shape = 3;
    particleColor.set(200,100);
    prevPos.set(0, 0);
}
//------------------------------------------------------------
particle::particle(){
    ofSetBackgroundAuto(false);
	setInitialCondition(0,0,0,0);
	damping = 0.09f;
   
  

}
Example #12
0
//--------------------------------------------------------------
void petal::setup(ofImage &IMAGE, float x, float y, float Angle, float Scale){
    
    image = &IMAGE;
    setInitialCondition(x, y, 0, 0);
    angle =  Angle*RAD_TO_DEG;
    offset = ofRandom(1000);
    scale = Scale;
}
Example #13
0
//------------------------------------------------------------
particle::particle(){
	setInitialCondition(0,0,0,0);
	damping = 0.05f;
	
	red = 0;
	green = 0;
	blue = 0;
	alpha = 1;
}
Example #14
0
Particle::Particle(){
    setInitialCondition(ofGetWindowWidth()/2, ofGetWindowHeight()/2, 0, 0);
    
    dampening= 0.09; 
   
    angle=0;

   
 
}
Example #15
0
//--------------------------------------------------------------
void petal::setup(ofImage &IMAGE, ofImage &ImageHovered,float x, float y, float Angle, bool NotTouch){
    
    image = &IMAGE;
    imageHovered = &ImageHovered;
    setInitialCondition(x, y, 0, 0);
    angle =  Angle*RAD_TO_DEG;
    isNotTouch = NotTouch;
    
    
}
Example #16
0
//コンストラクタ(初期化)
P3d::P3d(){
	setInitialCondition(0,0,0,0,0,0);
	damping = 0.0;
    gravity = 0.0;
    coreMode = false;
    core = ofVec3f(ofGetWidth()/2, ofGetHeight()/2, -70);
    col.set(ofRandom(255), ofRandom(255), ofRandom(255));
    imageId = 0;
    width = 0;
    height = 0;
}
Example #17
0
//------------------------------------------------------------
particle::particle(){
	setInitialCondition(0,0,0,0);
	damping = 0.015f;
    drawWhat = 0;
    _posx=0;
    _posy=0;
    radius = 30;
    prevPos.set(0, 0);
    catchUpSpeed = 0.03f;
    
}
//------------------------------------------------------------
particle::particle(){
    
    //initialize particles
    setInitialCondition(0, 0, 0, 0);
    damping = 0.02f;
    dampingTwo = 0.01f;
    
    circleRadius = sin(ofGetElapsedTimef()*2.0);
    circleRadiusMap = ofMap(circleRadius, -1, 1, 5, 10);
//    circleRadius = 3;
    
}
Example #19
0
//------------------------------------------------------------
// constructor
//------------------------------------------------------------
particle::particle(){
    //set the inital conditions to 0
	setInitialCondition(0,0,0,0);
    
    //set the initial color to black
    setInitialColor(0, 0, 0);
    
    //apply a number for damping
	damping = 0.01f; // like pct!!!
    
    radius = 3;
}
Example #20
0
//------------------------------------------------------------
particle::particle(){
    seperation.distance		= 20;
    alignment.distance		= 80;
    cohesion.distance		= 40;
    
    seperation.strength		= .03;
    alignment.strength		= .015;
    cohesion.strength		= .015;
    
	setInitialCondition(0,0,0,0);
	damping = 0.08f;
}
//------------------------------------------------------------
pointMass::pointMass(){
	setIntegrationStep(.01); // default in case we don't call integration step setting
	// NOTE: it is important to set dt before inital conditions in case of VERLET integration, because we need the integration
	// step for properly setting the initial speed.
	setInitialCondition(0,0,0,0);// default in case we don't call to initial conditions.
	setWallLimits(2000, 2000, 300, 300);
	mass=1.0; 
	dampMotion = 0.07f;
	dampBorder = 0.07f;
	bFixed = false;
	bDidICollide=false;
    myTopology=Bounce;
}
//------------------------------------------------------------
particle::particle(ofPoint _center, ofColor _color){
    center = _center;
    color = _color;
    originalColor = _color;
    opacity = 100;
    //color.set(ofRandom(255), ofRandom(255), ofRandom(255));
    setInitialCondition(center.x, center.y, ofRandom(-3, 3), ofRandom(-3, 3));
    done = false;
    counter = 0;
    streakLength = ofRandom(50, 100);
    
   
}
Example #23
0
void
AddVariableAction::act()
{
  if (_current_task == "add_variable")
  {
    // Get necessary data for creating a variable
    std::string var_name = getShortName();
    addVariable(var_name);
  }

  // Set the initial condition
  if (_current_task == "add_ic")
    setInitialCondition();
}
firework::firework(ofPoint _start){
    setInitialCondition(_start.x, _start.y, ofRandom(-2, 2), ofRandom(-7, -8));
    color.set(255, 255, 255);
    colorExplosion.set(ofRandom(100,255), ofRandom(100, 255), ofRandom(100, 255));
    explode = false;
    done = false;
    fireworkSound.loadSound("whistleFirework.mp3");
    fireworkSound.setVolume(0.50f);
    fireworkSound.play();
    explosionSound.loadSound("fireworkExplosion.mp3");
    //explosionSound.setVolume(0.25f);
    fireWorkExplodeVel = ofRandom(1, 3);
    
}
Example #25
0
//------------------------------------------------------------
particle::particle(){
	setInitialCondition(0,0,0,0);
	damping	= 0.01f;
	
	seperation.distance		= 20;
	alignment.distance		= 80;
	cohesion.distance		= 40;
	
	seperation.strength		= .03;
    alignment.strength		= .015;
	cohesion.strength		= .015;
    
    size = 10;
//	scale = 10;
    r1=r2=r3=1;
}
Example #26
0
//------------------------------------------------------------
particle::particle(){
	setInitialCondition(0,0,0,0);
	damping = 0.01f;
    
    seperation.distance		= 20;
	alignment.distance		= 80;
	cohesion.distance		= 40;
	
	seperation.strength		= .07;
    alignment.strength		= .015;
	cohesion.strength		= .015;
    
    //bird.loadImage("bird.png");
    //weed.loadImage("tumbleweed3.png");
    //firefly.loadImage("firefly.png");
    //birdSize = 10;
    r = 1.75;
}
Example #27
0
//------------------------------------------------------------
particle::particle() {
    setInitialCondition(0,0,0,0);
    damping	= 0.5f;

    seperation.distance		= 20;
    alignment.distance		= 80;
    cohesion.distance		= 40;

    seperation.strength		= .3;
    alignment.strength		= .015;
    cohesion.strength		= .015;

    size = 0;
    scale = 5;
    r1=r2=r3=1;
    age = ofGetElapsedTimef();

}
//------------------------------------------------------------
ofxParticle::ofxParticle(int width_,int height_, int lifeTime_, int radius_, float fadeOut_){
	setInitialCondition(0,0,0,0);
    
    width = width_;
    height = height_;
    isAlive = true;
    lifeTime = lifeTime_;
    radius = radius_;
    fadeOut = fadeOut_;
    creationTime = ofGetElapsedTimeMillis();
    
	damping	= 0.03f;
	
    seperation.distance		= ofRandom(5,50);
	//seperation.distance		= 35;
	alignment.distance		= 80;
	cohesion.distance		= 90;
	
	seperation.strength		= .03;
    alignment.strength		= .015;
	cohesion.strength		= .015;
	
}
Example #29
0
//------------------------------------------------------------
particle::particle(){
	setInitialCondition(0,0,0,0);
	damping = 0.111f;
}
Example #30
0
//初期化
Particle::Particle(){
    setInitialCondition(0,0,0,0);
    damping = 0.01f;
    outOffsetX = 100.0f;
    outOffsetY = 500.0f;
}