Exemplo n.º 1
0
//----------------------------------------------------------------------------
void NURBSCurveExample::OnKeyDown (unsigned char ucKey, int, int)
{
    if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE )
    {
        RequestTermination();
        return;
    }

    switch ( ucKey )
    {
    case 'g':
        if ( m_fSimTime <= 1.0f )
            DoSimulation1();
        else if ( m_fSimTime <= 2.0f )
            DoSimulation2();
        else
            InitialConfiguration();
        break;
    case '0':
        InitialConfiguration();
        OnDisplay();
        break;
    case 'c':
        m_bDrawControlPoints = !m_bDrawControlPoints;
        OnDisplay();
        break;
    }
}
Exemplo n.º 2
0
//----------------------------------------------------------------------------
bool NURBSCurveExample::OnKeyDown (unsigned char key, int x, int y)
{
    if (WindowApplication2::OnKeyDown(key, x, y))
    {
        return true;
    }

    switch (key)
    {
    case 'g':
        if (mSimTime <= 1.0f)
        {
            DoSimulation1();
        }
        else if (mSimTime <= 2.0f)
        {
            DoSimulation2();
        }
        else
        {
            InitialConfiguration();
        }
        return true;
    case '0':
        InitialConfiguration();
        OnDisplay();
        return true;
    case 'c':
        mDrawControlPoints = !mDrawControlPoints;
        OnDisplay();
        return true;
    }

    return false;
}
Exemplo n.º 3
0
//----------------------------------------------------------------------------
bool PolygonDistance::OnInitialize ()
{
	if (!WindowApplication2::OnInitialize())
	{
		return false;
	}

	// Warm up the random number generator.
	srand((unsigned int)time(0));
	int i, j = rand() % 100;
	for (i = 0; i < j; ++i)
	{
		rand();
	}

	for (i = 0; i < NUM_POLYGONS; ++i)
	{
		mPolygons[i].NumVertices = 5 - i;
		mPolygons[i].Vertices = new1<Vector2f>(mPolygons[i].NumVertices);
		mPolygons[i].Polars = new1<Vector2f>(mPolygons[i].NumVertices);
		mPolygons[i].Faces = new1<Tuple<2,int> >(mPolygons[i].NumVertices);
	}

	InitialConfiguration();
	OnDisplay();
	return true;
}
Exemplo n.º 4
0
//----------------------------------------------------------------------------
bool PolygonDistance::OnKeyDown (unsigned char key, int x, int y)
{
	if (WindowApplication2::OnKeyDown(key, x, y))
	{
		return true;
	}

	switch (key)
	{
	case 'g':
		NextConfiguration();
		OnDisplay();
		return true;
	case '0':
		InitialConfiguration();
		OnDisplay();
		return true;
	case 'p':  // toggle for drawing the perpendiculars
		mDrawPerpendiculars = !mDrawPerpendiculars;
		OnDisplay();
		return true;
	}

	return false;
}
Exemplo n.º 5
0
//----------------------------------------------------------------------------
bool NURBSCurveExample::OnInitialize ()
{
    if ( !Application2::OnInitialize() )
        return false;

    InitialConfiguration();
    OnDisplay();
    return true;
}