当前位置: 首页>>代码示例>>C++>>正文


C++ Vec2D函数代码示例

本文整理汇总了C++中Vec2D函数的典型用法代码示例。如果您正苦于以下问题:C++ Vec2D函数的具体用法?C++ Vec2D怎么用?C++ Vec2D使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Vec2D函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEST

TEST(PositioningTestGroup, CircleOfDeath)
{
    position_t p_a = {1, 0};
    position_t p_b = {0, 1};
    position_t p_c = {-1, 0};

    reference_triangle_t t = {NULL, NULL, NULL, 0, 0, 0};

    positioning_reference_triangle_from_points(&p_a, &p_b, &p_c, &t);

    position_t some_point = {0.0f, -1.0f};

    Angles angles = Vec2D(&some_point).angles_relative_to_triangle(&t);

    position_t result = {0, 0};

    bool valid = positioning_from_angles(
            angles.alpha,
            angles.beta,
            angles.gamma,
            &t,
            &result);
    CHECK(!valid);
    CHECK(Vec2D(&result) != Vec2D(&some_point));
}
开发者ID:31415us,项目名称:beacons,代码行数:25,代码来源:positioning_test.cpp

示例2: center

void hgeh::render_circle_slice( HGE *hge, float x, float y, float radius, int segments, float begin, float end, DWORD color )
{
	const float increment = ( end - begin ) / segments;
	float theta = begin;
	
	const Vec2D center( x, y );
	
	typedef std::vector<Vec2D> Positions;
	Positions positions;
	for( int i = 0; i < segments + 1; ++i )
	{
		Vec2D p = Vec2D( std::cos( theta ), std::sin( theta ) );
		p *= radius;
		p += center;
		positions.push_back( p );
		theta += increment;
	}
	
	render_lines( hge, positions, color );
	
	Vec2D first = Vec2D( std::cos( begin ), std::sin( begin ) ) * radius + center;
	Vec2D last = Vec2D( std::cos( end ), std::sin( end ) ) * radius + center;
	//-1 correct point
	hge->Gfx_RenderLine( center.x - 1, center.y, first.x, first.y, color );
	hge->Gfx_RenderLine( center.x, center.y, last.x, last.y, color );
}
开发者ID:treeman,项目名称:Rejection,代码行数:26,代码来源:HgeHelpers.cpp

示例3: RetourInfos

int RetourInfos(int x_info,int y_info)
{

    neuro.Print(string_numeric_entry,x_info,y_info+15);//input chaine clavier numerique
    petitchiffre.Print(string_last_ch,x_info,y_info+30);//input last ch selected
    petitchiffre.Print(string_last_copy_mem,x_info+170,y_info+30);

    Rect VisuHue(Vec2D(x_info+290,y_info+15),Vec2D(30,20));
    Rgba CouleurPreviewHue(r_pick,v_pick,b_pick,255);
    VisuHue.Draw(CouleurPreviewHue);
    Rgba CouleurPreviewChroma(my_red,my_green,my_blue,255);
    Rect VisuChroma(Vec2D(x_info+325,y_info+15),Vec2D(30,20));
    VisuChroma.Draw(CouleurPreviewChroma);
    petitpetitchiffre.Print(string_dock_col_sel,x_info+293,y_info+30);
    
    petitchiffre.Print(string_secondary_feeback,x_info,y_info+45);//
    petitchiffrerouge.Print(string_display_dmx_params,x_info,y_info+60);
    petitchiffre.Print(">>MIDI IN:",x_info, y_info+75);//midi in  
    petitchiffre.Print(my_midi_string,x_info+70, y_info+75);//midi in 

    petitchiffre.Print("Time Is:",x_info,y_info+90);
    petitchiffre.Print(tmp_time,x_info+60,y_info+90); 
    sprintf(visu_chrono_str,"Chrono: %d..%d.%d",time_minutes,time_secondes, time_centiemes);
    petitchiffre.Print(visu_chrono_str,x_info+170,y_info+90);
    petitchiffrerouge.Print(string_Last_Order,x_info, y_info+105);//last order   
    diodes_artnet(x_info,y_info+120);  
    if(index_do_light_diode_artnet==1){light_temoin_universe(incoming_universe,x_info,y_info+120);index_do_light_diode_artnet=0;  } 
    if((myDMXinterfaceis==1 && index_init_dmx_ok==1) || index_artnet_doubledmx==1) {light_temoin_emission(Univers,x_info,y_info+120);}    
 
  
    
    return(0); 
}
开发者ID:ChristophGuillermet,项目名称:WHITECAT_opensource,代码行数:33,代码来源:graphics_rebuild1.cpp

示例4: RX_GET_INPUT_LAYOUT

void rxScreenTriangle::Initialize()
{
    if( ! vertexLayout )
    {
        vertexLayout = RX_GET_INPUT_LAYOUT( ScreenVertex );
    }
    if( ! vertexBuffer )
    {
        // NOTE: z = 1 (the farthest possible distance) -> optimization for deferred lighting/shading engines:
        // skybox outputs z = w = 1 -> if we set depth test to less than the sky won't be shaded
        //
        const ScreenVertex vertices[VERTEX_COUNT] =
        {
            ScreenVertex( Vec4D( -1.0f, -3.0f, 1.0f, 1.0f ), Vec2D( 0.0f, 2.0f ) ),	// lower-left
            ScreenVertex( Vec4D( -1.0f,  1.0f, 1.0f, 1.0f ), Vec2D( 0.0f, 0.0f ) ),	// upper-left
            ScreenVertex( Vec4D(  3.0f,  1.0f, 1.0f, 1.0f ), Vec2D( 2.0f, 0.0f ) ),	// upper-right
        };

        vertexBuffer = rxResourceServer::Get().NewVertexBuffer(
                           sizeof( vertices ),
                           sizeof(vertices[0]),
                           vertices
                       );
    }
}
开发者ID:S-V,项目名称:Lollipop,代码行数:25,代码来源:ScreenQuad.cpp

示例5: drawTestPattern

void drawTestPattern(Paintable *paintable, int index)
{
	Painter painter(paintable);
	
	switch (index)
	{
		case 0:
			painter.setColor(Color::fromRgbValue(1,0,0));
			painter.drawEllipse(128, 96, 64, 32);
			break;
		case 1:
			painter.setColor(Color::fromRgbValue(0,1,0));
			painter.drawRect(128, 96, 128, 96);
			break;
		case 2:
		{
			Polygon polygon;
			polygon << Vec2D(256, 128) << Vec2D(192, 256) << Vec2D(320, 256);
			painter.drawPolygon(polygon);
			break;
		}
		default:
			break;
	}
}
开发者ID:h2so5,项目名称:PaintField,代码行数:25,代码来源:testutil.cpp

示例6: getCell

void CTerrainData::getGrassVertexByCell(int nCellX, int nCellY, TerrainVertex*& vertex)const
{
	const TerrainCell* cell1 = getCell(nCellX,nCellY);
	const TerrainCell* cell2 = getCell(nCellX+1,nCellY+1);
	int	nRand = (((nCellY*m_nVertexXCount+nCellX+nCellX*nCellY)*214013L+2531011L)>>16)&0x7fff;   
	float fTexU = (nRand%4)*0.25f;
	vertex[0].p = Vec3D((float)nCellX, cell1->fHeight, (float)nCellY);
	//vertex[0].n = Vec3DGetCellNormal(posCell1);
	vertex[0].c = cell1->color;
	vertex[0].t0 = Vec2D(fTexU,1.0f);

	vertex[1].p = vertex[0].p+Vec3D(0.0f,1.5f,0.0f);
	//vertex[1].n = vertex[0].n;
	vertex[1].c = vertex[0].c;
	vertex[1].t0 = Vec2D(fTexU,0.0f);

	vertex[3].p = Vec3D((float)(nCellX+1), cell2->fHeight, (float)(nCellY+1));
	//vertex[3].n = GetCellNormal(posCell2);
	vertex[3].c = cell2->color;
	vertex[3].t0 = Vec2D(fTexU+0.25f,1.0f);

	vertex[2].p = vertex[3].p+Vec3D(0.0f,1.5f,0.0f);
	//vertex[2].n = vertex[3].n;
	vertex[2].c = vertex[3].c;
	vertex[2].t0 = Vec2D(fTexU+0.25f,0.0f);
}
开发者ID:Pinkof,项目名称:rpgskyengine,代码行数:26,代码来源:TerrainData.cpp

示例7: draw_curve_node

int draw_curve_node(int n)
{
    if(n<6) {
        Circle(curve_nodes[n].x, curve_nodes[n].y, 6).DrawOutline(CouleurBlind);
        petitchiffre.Print(ol::ToString(n),curve_nodes[n].x-7, curve_nodes[n].y-7);
    }


    if( window_focus_id==W_PATCH && mouse_x>=((curve_nodes[n].x)-(diam_curve_node/2)) && mouse_x<=((curve_nodes[n].x)+(diam_curve_node/2))
            && mouse_x>=xpatch_window+30+455 && mouse_x<=xpatch_window+30+455+255
            && mouse_x>(curve_nodes[n-1].x+(diam_curve_node/2)) && mouse_x<(curve_nodes[n+1].x-(diam_curve_node/2))
            && mouse_y>=ypatch_window+50 && mouse_y<=ypatch_window+255+50    )
    {
        Line( Vec2D( curve_nodes[n].x, ypatch_window+50 ), Vec2D(curve_nodes[n].x,ypatch_window+255+50)).Draw(Rgba::YELLOW);
        Circle(curve_nodes[n].x, curve_nodes[n].y, 6).Draw(CouleurBlind);

        if(mouse_b&1 && index_enable_curve_editing==1 )
        {
            if(n>1 && n<5)
            {
                curve_ctrl_pt[curve_selected][n][0]=mouse_x-(xpatch_window+30+455);
                curve_ctrl_pt[curve_selected][n][1]=mouse_y-(ypatch_window+50);
            }
            if(n==1)
            {
                curve_ctrl_pt[curve_selected][n][0]=0;
                curve_ctrl_pt[curve_selected][n][1]=mouse_y-(ypatch_window+50);
            }
            if(n==5)
            {
                curve_ctrl_pt[curve_selected][n][0]=255;
                curve_ctrl_pt[curve_selected][n][1]=mouse_y-(ypatch_window+50);
            }

            write_curve();//ecriture des niveaux
        }

    }

    if (dmx_view==1)//255
    {
        //affichage OUT
        petitpetitchiffrerouge.Print(ol::ToString(255-curve_ctrl_pt[curve_selected][n][1]),xpatch_window+5+455,ypatch_window+50+curve_ctrl_pt[curve_selected][n][1]);
        //affichage IN
        petitpetitchiffre.Print(ol::ToString(curve_ctrl_pt[curve_selected][n][0]),xpatch_window+455+20+curve_ctrl_pt[curve_selected][n][0],ypatch_window+50+270);
    }
    else   if (dmx_view==0)//%
    {
        //affichage OUT
        petitpetitchiffrerouge.Print(ol::ToString((int)((255-curve_ctrl_pt[curve_selected][n][1])/2.55)),xpatch_window+5+455,ypatch_window+50+curve_ctrl_pt[curve_selected][n][1]);
        //affichage IN
        petitpetitchiffre.Print(ol::ToString((int)((curve_ctrl_pt[curve_selected][n][0])/2.55)),xpatch_window+455+20+curve_ctrl_pt[curve_selected][n][0],ypatch_window+50+270);
    }


    return(0);
}
开发者ID:ChristophGuillermet,项目名称:whitecat_crossplateform,代码行数:57,代码来源:patch_splines_2.cpp

示例8: Procedure

int  Procedure(char procedure_title[64],char procedure_subtitle[120])
{

Rect ProcedureAera( Vec2D( window_proc_x, window_proc_y), Vec2D ( 400,70));
ProcedureAera.SetRoundness(15);
ProcedureAera.Draw(CouleurBleuProcedure); 
ProcedureAera.DrawOutline(CouleurLigne); 
neuro.Print(procedure_title, window_proc_x+120,window_proc_y+20);
petitchiffre.Print( procedure_subtitle,window_proc_x+20, window_proc_y+45);
return(0);     
}
开发者ID:ChristophGuillermet,项目名称:WHITECAT_opensource,代码行数:11,代码来源:graphics_rebuild1.cpp

示例9: Vec2D

void Camera::drawRotateSquareOnWindowSwayed(Vec2D pos_center, Size size, double rot_angle, Color_RGB color, bool fill) {
	if (!this->isVisibleForWindowPos(pos_center + this->sway_now, size, rot_angle)) return;

	Vec2D p1 = pos_center + Mat2D::rotation(rot_angle, Vec2D(-size.width / 2, -size.height / 2)) + this->sway_now;
	Vec2D p2 = pos_center + Mat2D::rotation(rot_angle, Vec2D(size.width / 2, -size.height / 2)) + this->sway_now;
	Vec2D p3 = pos_center + Mat2D::rotation(rot_angle, Vec2D(size.width / 2, size.height / 2)) + this->sway_now;
	Vec2D p4 = pos_center + Mat2D::rotation(rot_angle, Vec2D(-size.width / 2, size.height / 2)) + this->sway_now;
	Color_RGB c = color*this->shield_ratio;

	DrawQuadrangle((int)p1.x, (int)p1.y, (int)p2.x, (int)p2.y, (int)p3.x, (int)p3.y, (int)p4.x, (int)p4.y, c.toColor(), fill);
}
开发者ID:wakefulwombat,项目名称:looperrooper,代码行数:11,代码来源:camera.cpp

示例10: length

Vec2D Vec2D::unit() const
{
  float l = length();
  if(l > 0)
  {
    return Vec2D(x / l, y / l);
  }
  else
  {
    return Vec2D(0, 0);
  }
}
开发者ID:Cloudef,项目名称:spacerocks,代码行数:12,代码来源:vec2d.cpp

示例11: do_keyboard_conf

int do_keyboard_conf(int cfgnetw_X, int cfgnetw_Y)//ancienne version
{

petitchiffre.Print("Keyboard Mapping: " ,cfgnetw_X, cfgnetw_Y);
Line(Vec2D(cfgnetw_X,cfgnetw_Y+5),Vec2D(cfgnetw_X+90,cfgnetw_Y+5)).Draw(CouleurLigne);
sprintf(string_clavier_is,"Asc= %d Allg= %d KEY= %s ",scan_ascii_is,scan_allegro_key_is,string_key_id);
petitchiffre.Print(string_clavier_is,cfgnetw_X,cfgnetw_Y+20);
char str_iskeyfunct[25];
for (int oi=0;oi<nbre_key_persos;oi++)
{
Rect keyParam(Vec2D(cfgnetw_X+60,cfgnetw_Y+25+(oi*30)),Vec2D(50,25));
keyParam.SetRoundness(7.5);
keyParam.SetLineWidth(epaisseur_ligne_fader);
keyParam.Draw(CouleurFond.WithAlpha(0.5));
switch(oi)
{
case 0:
sprintf(str_iskeyfunct,"AT LEVEL");
break;
case 1:
sprintf(str_iskeyfunct,"CH +");
break;
case 2:
sprintf(str_iskeyfunct,"CH -");
break;
case 3:
sprintf(str_iskeyfunct,"THRU");
break;
case 4:
sprintf(str_iskeyfunct,"CLEAR");
break;
}
if(mouse_x>cfgnetw_X+60 && mouse_x<cfgnetw_X+60+50 && mouse_y>cfgnetw_Y+25+(oi*30) && mouse_y<cfgnetw_Y+25+(oi*30)+25)
{
keyParam.DrawOutline(CouleurLevel);
if(mouse_button==1 && mouse_released==0)
{
int tmp_valAsc=atoi(numeric);
if((tmp_valAsc>0 && tmp_valAsc<255)|| tmp_valAsc==999)//999 pour eviter de bloquer les commandes en 0 ascii , genre touches de fonctions
{
mapping_temporaire[oi]=tmp_valAsc;
}
reset_numeric_entry();
mouse_released=1;
}
}
petitpetitchiffre.Print(str_iskeyfunct,cfgnetw_X,cfgnetw_Y+40+(oi*30));
petitpetitchiffre.Print(ol::ToString(mapping_temporaire[oi]),cfgnetw_X+75,cfgnetw_Y+40+(oi*30));
}

 return(0);
}
开发者ID:WnP,项目名称:whitecat_crossplateform,代码行数:52,代码来源:CFG_config_panel_8.cpp

示例12: fader_niveau_son

int fader_niveau_son(int xp, int yp, int numero)
{
Rect FaderSon(Vec2D(xp,yp),Vec2D(20,127));
FaderSon.SetRoundness(5);
Rect FaderSonNiveau(Vec2D(xp,yp+(127-player_niveauson[numero])),Vec2D(20,player_niveauson[numero]));
FaderSonNiveau.Draw(CouleurFader);
FaderSon.DrawOutline(CouleurLigne.WithAlpha(0.5));

petitpetitchiffre.Print(string_niveauson[numero],xp+22,yp+10);
petitpetitchiffre.Print(ol::ToString(player_niveauson[numero]),xp+22,yp+20);

if(window_focus_id==919 && Midi_Faders_Affectation_Type!=0 && mouse_x>xp && mouse_x<xp+20 && mouse_y>=yp && mouse_y<=yp+127 )
{
FaderSon.DrawOutline(CouleurBlind);
}

Line (Vec2D(xp+20,yp+107),Vec2D(xp+30,yp+112)).Draw(CouleurLigne);

Circle(Vec2D(xp+37,yp+117),7).Draw(CouleurBlind.WithAlpha(midi_send_out[616+numero]));
Circle(Vec2D(xp+37,yp+117),7).DrawOutline(CouleurLigne);

raccrochage_midi_visuel_vertical(xp,yp,616+numero,20,127);

return(0);
}
开发者ID:WnP,项目名称:whitecat_crossplateform,代码行数:25,代码来源:audio_visu4.cpp

示例13: level_wheel

int level_wheel (int xw,int yw, int rayon_k, float angle_correction)
{
Circle (Vec2D(xw,yw), rayon_k+5).DrawOutline(CouleurLigne);
Circle (Vec2D(xw,yw), rayon_k-5).DrawOutline(CouleurLigne);
Circle(Vec2D(position_curseur_pad_x,position_curseur_pad_y),5).Draw(CouleurBlind);

int poucentmidi=(int)((((float)midi_levels[664])/127)*100);
petitpetitchiffrerouge.Print(ol::ToString(poucentmidi),xw-5,yw+2);
petitpetitchiffre.Print(ol::ToString(midi_levels[664]),xw-5,yw+12);

//AFFECTATION MIDI
if( Midi_Faders_Affectation_Type!=0)//config midi
  {
  if(mouse_x>xw-rayon_k-5 && mouse_x<xw+rayon_k+5 && mouse_y>yw-rayon_k-5 && mouse_y<yw+rayon_k+5)
  {
  Circle (Vec2D(xw,yw), rayon_k+5).DrawOutline(CouleurBlind);
  if(mouse_button==1 && mouse_released==0)
  {
  Circle (Vec2D(xw,yw), rayon_k+5).Draw(CouleurBlind);
  }
  }
}

//toggle mode Relativ / absolute
Rect WheelMode(Vec2D(xw+rayon_k+10,yw-rayon_k),Vec2D(15,15));
WheelMode.SetRoundness(3);

switch(wheellevel_absolutemode)
{
case 0:
WheelMode.Draw(CouleurLock);
petitchiffre.Print("R",xw+rayon_k+13,yw-rayon_k+12);
break;
case 1:
WheelMode.Draw(CouleurSurvol);
petitchiffre.Print("A",xw+rayon_k+13,yw-rayon_k+12);
break;
}
WheelMode.DrawOutline(CouleurLigne);

//midi out
Line (Vec2D(xw+rayon_k,yw+rayon_k-3),Vec2D(xw+rayon_k+7,yw+rayon_k+7)).Draw(CouleurLigne);
Circle MidiOutW(Vec2D(xw+rayon_k+10,yw+rayon_k+10),7);
if(midi_send_out[664]==1){MidiOutW.Draw(CouleurBlind);}

MidiOutW.DrawOutline(CouleurLigne);

return(0);
}
开发者ID:AntonLanghoff,项目名称:whitecat_crossplateform,代码行数:49,代码来源:numpad_visuel.cpp

示例14: Vec2D

void hgeh::render_circle_slice( HGE *hge, const Vec2D center, float radius, int segments, float begin, float end, DWORD color )
{
	const float increment = ( end - begin ) / segments;
	float theta = begin;
	
	typedef std::vector<Vec2D> Positions;
	Positions positions;
	for( int i = 0; i < segments; ++i )
	{
		Vec2D p = Vec2D( std::cos( theta ), std::sin( theta ) );
		p *= radius;
		p += center;
		positions.push_back( p );
		theta += increment;
	}
	
	for( Positions::iterator it = positions.begin(); it != positions.end(); )
	{
		Vec2D p1 = *it;
		++it;
		Vec2D p2;
		if( it != positions.end() ) {
			p2 = *it;
		}
		else {
			break;
		}
		hge->Gfx_RenderLine( p1.x, p1.y, p2.x, p2.y, color );
	}
}
开发者ID:jsj2008,项目名称:100-things,代码行数:30,代码来源:HgeHelpers.cpp

示例15: setNextIndex

	void PathMove::computeNextMove( Object& obj )
	{
		setNextIndex();

		if ( nextIndex >= path.size())
		{
			obj.setVelocity( Vec2D(0,0) );
			return;
		}

		Vec2D& nexPos = path[nextIndex];
		moveSpeed = nexPos - obj.getPos();

		float dist = sqrtf( moveSpeed.length2() );
		moveTime = dist / speed;

		if ( fabs( moveTime ) <= 0.000001 )
		{
			computeNextMove(obj);
			return;
		}

		moveSpeed = ( 1 / moveTime )* moveSpeed;

		obj.setVelocity( moveSpeed );
	}
开发者ID:uvbs,项目名称:GameProject,代码行数:26,代码来源:Action.cpp


注:本文中的Vec2D函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。