Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…s a FixedScale example
  • Loading branch information
nicolaje committed Oct 13, 2015
2 parents a3d6d1a + 1a93788 commit 5b37574
Show file tree
Hide file tree
Showing 6 changed files with 386 additions and 211 deletions.
6 changes: 5 additions & 1 deletion client-api/C++/examples/all_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ int main()
VIBES_TEST( vibes::drawPie(0,-20,3,1,-20, -220, "black[red]") );
VIBES_TEST( vibes::drawPie(10,-20,3,4,700, 800, "black[red]") );
VIBES_TEST( vibes::drawPie(5,-20,3,3,20, 120, "black[red]") );

cout << "drawRing"<< endl;
VIBES_TEST( vibes::drawRing(42,42,20,23,"black[red]"));

cout << "drawBoxes with vector of vector of bounds" << std::endl;
{
Expand All @@ -236,7 +239,8 @@ int main()
}

cout << "drawPoint"<<endl;
VIBES_TEST(vibes::drawPoint(17,17,"red[black]"));
VIBES_TEST(vibes::drawPoint(17,17,"red[darkyellow]"));
VIBES_TEST(vibes::drawPoint(27,27,2,vibesParams("FaceColor","magenta","EdgeColor","none","Draggable",true,"FixedScale",false)));

VIBES_TEST( vibes::axisAuto() );
// VIBES_TEST( vibes::axisLimits(-1,1, -3,2) );
Expand Down
5 changes: 3 additions & 2 deletions client-api/C++/examples/interval/box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ box& box::Intersect(const box& Y)
{ box X=*this;
box Z=Inter(X,Y);
*this=Z;
return *this;
}


Expand Down Expand Up @@ -208,7 +209,7 @@ box Sup(box X)
}
//----------------------------------------------------------------------
box Concat(const box& X, const box& Y)
/* Produit Cartesien ou Concaténation de deuX pavés X et y :
/* Produit Cartesien ou Concat�nation de deuX pav�s X et y :
Ans=[X,Y] => Ans=Concat(X,Y); */
{ double dim=X.Size()+Y.Size(); box Ans(dim);
if ((!X.IsEmpty())&&(!Y.IsEmpty()))
Expand All @@ -219,7 +220,7 @@ box Concat(const box& X, const box& Y)
}
//----------------------------------------------------------------------
box Proj(const box& X, int i, int j)
/* Projection du pavé X dans un espace de dimension dim=(j-i)+1;
/* Projection du pav� X dans un espace de dimension dim=(j-i)+1;
X=[[X1],[X2],..,[Xi],..,[Xj],..[Xn]]
=> Proj(X,i,j)=[[Xi],..,[Xj]] et Proj(X,i,i)=[Xi] */
{ int dim=abs(j-i)+1; box Ans(dim);
Expand Down
24 changes: 23 additions & 1 deletion client-api/C++/src/vibes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,29 @@ namespace vibes
msg["figure"]=params.pop("figure",current_fig);
msg["shape"]=(params, "type","point",
"point",(Vec2d){cx,cy});

fputs(Value(msg).toJSONString().append("\n\n").c_str(), channel);
fflush(channel);
}

void drawPoint(const double &cx, const double &cy, const double &radius, Params params)
{
Params msg;
msg["action"]="draw";
msg["figure"]=params.pop("figure",current_fig);
msg["shape"]=(params, "type","point",
"point",(Vec2d){cx,cy},"Radius",radius);
fputs(Value(msg).toJSONString().append("\n\n").c_str(), channel);
fflush(channel);
}

void drawRing(const double &cx, const double &cy, const double &r_min, const double &r_max, Params params)
{
Params msg;
msg["action"] = "draw";
msg["figure"] = params.pop("figure",current_fig);
msg["shape"] = (params, "type", "ring",
"center", (Vec2d){cx,cy},
"rho", (Vec2d){r_min,r_max});
fputs(Value(msg).toJSONString().append("\n\n").c_str(), channel);
fflush(channel);
}
Expand Down
7 changes: 7 additions & 0 deletions client-api/C++/src/vibes.h
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,13 @@ namespace vibes {
/// Draw a Point at position (cy, cy)
VIBES_FUNC_COLOR_PARAM_2(drawPoint, const double &,cx, const double &,cy)

/// Draw a Point at position (cy, cy)
VIBES_FUNC_COLOR_PARAM_3(drawPoint, const double &,cx, const double &,cy, const double &,radius)

/// Draw a ring at position (cx, cy) with radius between (r_min, r_max)
VIBES_FUNC_COLOR_PARAM_4(drawRing, const double &,cx, const double &,cy,
const double &,r_min, const double &,r_max)

/// @}
/// @name Objects grouping and deletion
/// @{
Expand Down
Loading

0 comments on commit 5b37574

Please sign in to comment.