#include <iostream>
#include <fstream>
#include <string>
#include <filesystem>
namespace TMU{

using namespace std;
string str(double x){
    return to_string(x);
};
string str(int x){
    return to_string(x);
};
struct R2{
    double x;
    double y;
    R2(double x_, double y_){
        x = x_; y = y_;
    }
    R2(){x = 0; y = 0;}
};
R2 operator+(R2 a, R2 b){
    R2 r;
    r.x = a.x + b.x;
    r.y = a.y + b.y;
    return r;
}
struct SVGGraph{
    double vx0, vy0, H, W;
    double scale;
    double r;
  	string s;
    SVGGraph(){
        scale = 210; // firefox が小数点以下の座標をうまく表示しないため座標を大きく引き延ばすための値
        vx0 = -1.2; vy0 = -1.2; W= 2.4; H= 2.4; r=0.1;
        s = "";

    }
    void setPointSize(double r_){
        r = r_;
    }
	void circle(R2 p){
        s += "<circle r='" + str(r*scale) + "' cx='" +str(p.x*scale) + "' cy='"+str(p.y*scale) + "' fill='black' />\n";	
	}
    void drawVAxis(string title){
        s += "<text style='font-size:" + str(0.05*scale) + ";'  transform='translate(" + str(-1.1*scale) + ", 0) rotate(-90)'>"+title + "</text>";
        s += "<line x1='" + str(-1*scale) + "' y1='"+str(1*scale) + "' x2='" + str(-1*scale)+"' y2='" + str(-1*scale)+ "' style='stroke:rgb(0,0,0);stroke-width:"+ str(0.01*scale) + "' />";
    }
    void drawHAxis(string title){
        s += "<text style='font-size:" + str(0.05*scale) + ";'  transform='translate( 0, " + str(1.1*scale) + ") rotate(0)'>"+title + "</text>";
        s += "<line x1='" + str(-1*scale) + "' y1='"+str(1*scale) + "' x2='" + str(1*scale)+"' y2='" + str(1*scale)+ "' style='stroke:rgb(0,0,0);stroke-width:"+ str(0.01*scale) + "' />";
    }

	string serialize(){
        string r = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='"+to_string(vx0*scale)+" " + to_string(vy0*scale) + " " + to_string(W*scale) + " " + to_string(H*scale) + "'>\n";
        r = r + s + "</svg>\n";
        return r;
	}
};


}
