Skip to content

Axis on/off modification#148

Merged
godardma merged 7 commits into
ENSTABretagneRobotics:masterfrom
le-sigwal:master
Jan 5, 2026
Merged

Axis on/off modification#148
godardma merged 7 commits into
ENSTABretagneRobotics:masterfrom
le-sigwal:master

Conversation

@le-sigwal

Copy link
Copy Markdown
Contributor

Axis on/off

  • added vibes::axisOff() and vibes::axisOn() methods
  • use of existing "showAxis" figure poperty
  • Verified in examples/all_commands.cpp
image

Axis dimension modification

  • added vibes::axisDims() method
  • use of new parameter "axisdims"
  • Verified in examples/all_commands.cpp
image

Axis on/off
  - added vibes::axisOff() and vibes::axisOn() methods
  - use of existing "showAxis" figure poperty

Axis dimension modification
  - added vibes::axisDims() method
  - use of new parameter "axisdims"
added VIBES_TEST macro over new instuctions.
@godardma

godardma commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

Hello and thank you for your PR.

For the axis ON/OFF the "A" key of the keyboard can be used to do this operation on an active figure. From a "code" point of view it seems that the function has been defined in python but not in C++. Would it be possible for you to use the same signature ?

image

For the axis dimensions I am not sure that all the drawing functions support this change. For example the texts and vehicles have a

Q_ASSERT(center.size() == 2);

Would it be possible to check how these functions would behave if the dimensions are set to say 2 and 3 (as you did in the all_commands) ?

- axisOff()/axisOn() are replaced by showAxis() method in accordance with Python API
- Added Value type bool
- Added case vt_bool in Value::toJSONString()
@le-sigwal

Copy link
Copy Markdown
Contributor Author

Just commited showAxis() C++ API equivalent to corresponding Python API.
As a piece of information, added lacking bool type in Value class.
To be checked: axisDims() impacts.

axisdims: first x-axis modification may fails if requested dimension is in use in y-axis, second modification in this case
@le-sigwal

le-sigwal commented Nov 22, 2025

Copy link
Copy Markdown
Contributor Author

New study-case

#include "vibes.h"

int axisdims_vib_xpl(){

	vibes::beginDrawing(); // <Initializes the Vibes "connection"
	vibes::newFigure("axisdims_vib");     // <Creates a new Vibes figure;

	int fs=16;
	double length=8*((double)fs);

	double rot=0, cx=length, cy=length;
	vibes::drawText(cx, cy, "Bag Gwer", "[green]darkGreen",
			shaqParams("fontSize", fs, "fontName", "Arial"));
	cx=-length; cy= length; rot = 90;
	vibes::drawMotorBoat(cx, cy, rot, length, "darkYellow[yellow]");
	cx=-length; cy=-length; rot = 180;
	vibes::drawAUV(cx, cy, rot, length, "darkBlue[blue]");
	cx= length; cy=-length; rot = 270.0;
	vibes::drawTank(cx, cy, rot, length, "darkRed[red]");

	std::vector< std::vector<double> > polyg;
	const int dn = 3;    // point dimension
	std::vector<double> point(dn);

	point[0]= length; point[1]= length; point[2]= length; polyg.push_back(point);
	point[0]=-length; point[1]= length; point[2]= length; polyg.push_back(point);
	point[0]=-length; point[1]=-length; point[2]= length; polyg.push_back(point);
	point[0]= length; point[1]=-length; point[2]=-length; polyg.push_back(point);
	point[0]= length; point[1]= length; point[2]=-length; polyg.push_back(point);
	point[0]=-length; point[1]= length; point[2]=-length; polyg.push_back(point);
	vibes::drawLine(polyg, "lightGray");

	vibes::axisAuto();
	vibes::axisEqual("axisdims_vib");
	vibes::saveImage("./axisdims_vib.svg");

	std::vector<int> dims;
	dims.push_back(0); dims.push_back(2); dims.push_back(1);
	vibes::axisDims(dims);
	vibes::axisAuto();
	vibes::axisEqual("axisdims_vib");
	vibes::saveImage("./axisdims_vib_0-2-1.svg");

	dims[0]=1; dims[1]=0; dims[2]=2;
	vibes::axisDims(dims);
	/*vibes::axisAuto();
	vibes::axisEqual("axisdims_vib");*/
	vibes::saveImage("./axisdims_vib_1-0-2.svg");

	dims[0]=1; dims[1]=2; dims[2]=0;
	vibes::axisDims(dims);
	/*vibes::axisAuto();
	vibes::axisEqual("axisdims_vib");*/
	vibes::saveImage("./axisdims_vib_1-2-0.svg");

	dims[0]=2; dims[1]=0; dims[2]=1;
	vibes::axisDims(dims);
	/*vibes::axisAuto();
	vibes::axisEqual("axisdims_vib");*/
	vibes::saveImage("./axisdims_vib_2-0-1.svg");

	dims[0]=2; dims[1]=1; dims[2]=0;
	vibes::axisDims(dims);
	/*vibes::axisAuto();
	vibes::axisEqual("axisdims_vib");*/
	vibes::saveImage("./axisdims_vib_2-1-0.svg");

	// Back to initial graph
	dims[0]=0; dims[1]=1; dims[2]=2;
	vibes::axisDims(dims);
	/*vibes::axisAuto();
	vibes::axisEqual("axisdims_vib");*/
	vibes::saveImage("./axisdims_vib_0-1-2.svg");


	vibes::endDrawing(); // <Closes the Vibes "connection"

	return 0;
}
image

@godardma godardma self-assigned this Nov 24, 2025
@godardma

Copy link
Copy Markdown
Contributor

Hello,

From your study-case I see that the change of axis index/dimension does not behave consistently across all drawing functions. Since it may be confusing for users, would it be possible to do a PR with only the axis ON/OFF feature for now ?

PS : begin and end drawing are now not needed anymore since PR #128

@le-sigwal le-sigwal changed the title Axis on/off and axis dimension modification Axis on/off modification Dec 28, 2025
@godardma godardma merged commit 566cd8d into ENSTABretagneRobotics:master Jan 5, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants