Exemple #1
0
void SinWaveObject::BuildMesh(TimeValue t)
	{		
	int startVert = 1, face = 0, nverts, nfaces, numCircles, numCircleSegs, divs;
	float radius = float(0);
	float dr;
	float a, a2, w, s, d;	

	ivalid = FOREVER;
	pblock->GetValue(PB_AMPLITUDE,t,a,ivalid);
	pblock->GetValue(PB_AMPLITUDE2,t,a2,ivalid);
	pblock->GetValue(PB_WAVELEN,t,w,ivalid);
	pblock->GetValue(PB_PHASE,t,s,ivalid);
	pblock->GetValue(PB_DECAY,t,d,ivalid);
	pblock->GetValue(PB_SEGMENTS,t,numCircleSegs,ivalid);
	pblock->GetValue(PB_CIRCLES,t,numCircles,ivalid);
	pblock->GetValue(PB_DIVISIONS,t,divs,ivalid);
	LimitValue(d,0.0f,float(1.0E30));

	dr     = w/float(divs);
	nverts = numCircles * numCircleSegs + 1;
	nfaces = (numCircles-1) * numCircleSegs * 2;
	mesh.setNumVerts(nverts);
	mesh.setNumFaces(nfaces);

	mesh.setVert( 0, Point3(0,0,0) );
	MakeCircle(t,mesh,0,face,radius, a, a2, w, s, d, numCircleSegs);

	for ( int i = 1; i < numCircles; i++ ) {
		MakeCircle(t,mesh,startVert,face,radius, a, a2, w, s, d, numCircleSegs);
		startVert += numCircleSegs;
		radius += dr;
		}
	
	mesh.InvalidateGeomCache();
	}
Exemple #2
0
int main(int argc, const char *argv[])
{
  Node* head = CreateList();
  int v = 5;
  InsertList(head, v);
  InsertList(head, v);
  InsertList(head, v);
  v = 10;
  int i = InsertList(head, v, 4);
  v = 20;
  i = InsertList(head, v, 4);
  v = 1;
  i = InsertList(head, v);
  printf("i:%d\n", i);
  PList(head);
  printf("\n\n");
  PListRecurse(head->next);

  printf("\nreserve list:\n");
  ReserveList(head);
  PList(head);
  printf("\n---- reserve list\n");

  Node* p = GetNode(head, 1);
  if( NULL != p )
  {
    printf("\n0 node d:%d p:%016lX\n", p->d, reinterpret_cast<uint64_t>(p));
  }

  Node* head2 = CreateList();
  head2->next = p;
  printf("\nlist2\n");
  PList(head2);
  printf("\n");

  int retInterSection = CheckUnion(head, head2);
  printf("checkunion ret:%d\n", retInterSection);

  int ret = CheckCircle(head);
  printf("check circle:%d\n", ret);

  printf("makecircle \n");
  MakeCircle(head);
  //PList(head);

  retInterSection = CheckUnion(head, head2);
  printf("checkunion2 ret:%d\n", retInterSection);

  ret = CheckCircle(head);
  printf("check circle:%d\n", ret);

  i = FindInList(head, 20);
  printf("\nfind i:%d\n", i);
  
  return 0;
}
Exemple #3
0
void DonutObject::BuildShape(TimeValue t, BezierShape& ashape) {
	// Start the validity interval at forever and whittle it down.
	ivalid = FOREVER;
	float radius1;
	float radius2;

	pblock->GetValue(PB_RADIUS1, t, radius1, ivalid);
	
	if(mPipe)
	{
		float thickness;
		pblock->GetValue(PB_THICKNESS, t, thickness, ivalid);
		radius2 = radius1-thickness;
	}
	else
	{
	pblock->GetValue(PB_RADIUS2, t, radius2, ivalid);
	}
		
	LimitValue( radius1, MIN_RADIUS, MAX_RADIUS );
	LimitValue( radius2, MIN_RADIUS, MAX_RADIUS );

	ashape.NewShape();

	// Get parameters from SimpleSpline and place them in the BezierShape
	int steps;
	BOOL optimize,adaptive;
	ipblock->GetValue(IPB_STEPS, t, steps, ivalid);
	ipblock->GetValue(IPB_OPTIMIZE, t, optimize, ivalid);
	ipblock->GetValue(IPB_ADAPTIVE, t, adaptive, ivalid);
	ashape.steps = adaptive ? -1 : steps;
	ashape.optimize = optimize;

	MakeCircle(ashape,radius1);
	MakeCircle(ashape,radius2);
	ashape.UpdateSels();	// Make sure it readies the selection set info
	ashape.InvalidateGeomCache();
	}
Exemple #4
0
void EllipseObject::BuildShape(TimeValue t, BezierShape& ashape) {

	// Start the validity interval at forever and whittle it down.
	ivalid = FOREVER;
	float length;
	float width;
	pblock->GetValue(PB_LENGTH, t, length, ivalid);
	pblock->GetValue(PB_WIDTH, t, width, ivalid);
	LimitValue( length, MIN_LENGTH, MAX_LENGTH );
	LimitValue( width, MIN_WIDTH, MAX_WIDTH );

	// Delete the existing shape and create a new spline in it
	ashape.NewShape();

	// Get parameters from SimpleSpline and place them in the BezierShape
	int steps;
	BOOL optimize,adaptive;
	ipblock->GetValue(IPB_STEPS, t, steps, ivalid);
	ipblock->GetValue(IPB_OPTIMIZE, t, optimize, ivalid);
	ipblock->GetValue(IPB_ADAPTIVE, t, adaptive, ivalid);
	ashape.steps = adaptive ? -1 : steps;
	ashape.optimize = optimize;

	float radius, xmult, ymult;
	if(length < width) {
		radius = width;
		xmult = 1.0f;
		ymult = length / width;
		}
	else
	if(width < length) {
		radius = length;
		xmult = width / length;
		ymult = 1.0f;
		}
	else {
		radius = length;
		xmult = ymult = 1.0f;
		}
	MakeCircle(ashape, radius / 2.0f, xmult, ymult);
	ashape.UpdateSels();	// Make sure it readies the selection set info
	ashape.InvalidateGeomCache();
	}
void ScatteredCirclesBrush::BrushMove( const Point source, const Point target )
{
	ImpressionistDoc* pDoc = GetDocument();
	ImpressionistUI* dlg=pDoc->m_pUI;

	int scatterRadius = pDoc->getScatterRadius();
	float randAngle;

	if ( pDoc == NULL ) {
		printf( "ScatteredCirclesBrush::BrushMove  document is NULL\n" );
		return;
	}
	int radius = pDoc->getSize();
	for(int i = 0; i < 20; i++) {
		randAngle = frand() * 2 * M_PI;
		MakeCircle(Point(source.x + (frand() - 0.5) * scatterRadius * cos(randAngle),
			source.y + (frand() - 0.5) * scatterRadius * sin(randAngle)), radius);
	}
}
void Stopwatch() {
// dit is een methode dat een stopwatch op de harddrive doet verschijnen
//in het totaal moeten 6 getallen worden weergegeven
// ieder getal is gelinkt aan een counter, deze zijn hieronder gedeclareerd
	char secondenE = 0; //counter dat de eenheden van de seconden bijhoudt
	char secondenT = 0; //counter dat de tientallen van de seconden bijhoudt
//de volgende counters zijn analoog opgebouwd als deze voor de seconden
	char minutenE = 0;
	char minutenT = 0;
	char urenE = 0;
	char urenT = 0;
	char AsecondenE[16];
	char AsecondenT[16];
	char AminutenE[16];
	char AminutenT[16];
	char AurenE[16];
	char AurenT[16];
	while (1) {
		char* pSecondenE = Decode(secondenE);
		char* pSecondenT = Decode(secondenT);
		char* pMinutenE = Decode(minutenE);
		char* pMinutenT = Decode(minutenT);
		char* pUrenE = Decode(urenE);
		char* pUrenT = Decode(urenT);
		for (int i = 0; i < segments; i++) {
			AsecondenE[i] = *(pSecondenE + i);
		}
		for (int i = 0; i < segments; i++) {
			AsecondenT[i] = *(pSecondenT + i);
		}
		for (int i = 0; i < segments; i++) {
			AminutenE[i] = *(pMinutenE + i);
		}
		for (int i = 0; i < segments; i++) {
			AminutenT[i] = *(pMinutenT + i);
		}
		for (int i = 0; i < segments; i++) {
			AurenE[i] = *(pUrenE + i);
		}
		for (int i = 0; i < segments; i++) {
			AurenT[i] = *(pUrenT + i);
		}
		MakeCircle(AminutenT, AminutenE, DubbleDot, AsecondenT, AsecondenE,
				Dflt, Dflt, Dflt, Dflt, Dflt, Dflt, Dflt, Dflt, AurenT, AurenE,
				DubbleDot);

	}
//when timer ticks
	secondenE++;
	if (secondenE == 10) {
		secondenE = 0;
		secondenT++;
		if (secondenT == 6) {
			secondenT = 0;
			minutenE++;
			if (minutenE == 10) {
				minutenE = 0;
				minutenT++;
				if (minutenT == 6) {
					minutenT = 0;
					urenE++;
					if (urenE == 10) {
						urenE = 0;
						urenT++;
					}
				}
			}
		}
	}

}