Skip to content

.Solve(-) not working, gives out empty vector #25

@Icaka00

Description

@Icaka00

Hi, great work on the splines code. I just have a small issue i stumbled upon using it in my project. I'm trying to recreate this splines into my code. Thanks in advance! Here is the issue, the splines and my code:
image
image

 int WorldGen(float Cont, float Eros, float PV ) {
			int worldHeight = 0;
			//Peakes & Valleys
			std::vector<double> x1, y1;
			x1.push_back(0.05f);
			y1.push_back(0.f);

			x1.push_back(0.1f);
			y1.push_back(0.1f);

			x1.push_back(0.325f);
			y1.push_back(0.2f);

			x1.push_back(0.5f);
			y1.push_back(0.21f);

			x1.push_back(0.65f);
			y1.push_back(0.55f);

			x1.push_back(0.9f);
			y1.push_back(0.61f);

			x1.push_back(1.f);
			y1.push_back(0.65f);
			tk::spline PVSpl;
			PVSpl.set_points(x1, y1);

			//Erosion
			std::vector<double> x2, y2;
			x2.push_back(0);
			y2.push_back(1);

			x2.push_back(0.15f);
			y2.push_back(0.55f);

			x2.push_back(0.3f);
			y2.push_back(0.41f);

			x2.push_back(0.32f);
			y2.push_back(0.45f);

			x2.push_back(0.45f);
			y2.push_back(PVSpl.solve(PV)[0]);

			x2.push_back(0.6f);
			y2.push_back(0.11f);

			x2.push_back(0.7f);
			y2.push_back(0.11f);

			x2.push_back(0.72f);
			y2.push_back(0.28f);

			x2.push_back(0.78f);
			y2.push_back(0.28f);

			x2.push_back(0.79f);
			y2.push_back(0.11f);

			x2.push_back(0.85f);
			y2.push_back(0.05f);

			x2.push_back(1.f);
			y2.push_back(0.05f);
			tk::spline ErosSpl;
			ErosSpl.set_points(x2, y2);

			//Continetalness
			std::vector<double> x3, y3;
			x3.push_back(0);
			y3.push_back(1);

			x3.push_back(0.09f);
			y3.push_back(0.025f);
			
			x3.push_back(0.345f);
			y3.push_back(0.025f);
			
			x3.push_back(0.385f);
			y3.push_back(0.435f);

			x3.push_back(0.515f);
			y3.push_back(0.435f);

			x3.push_back(0.525f);
			y3.push_back(0.9f);

			x3.push_back(0.55f);
			y3.push_back(0.915f);

			x3.push_back(0.72f);
			y3.push_back(ErosSpl.solve(Eros)[0]);

			x3.push_back(1.f);
			y3.push_back(0.98f);

			tk::spline ContSpl;
			ContSpl.set_points(x3, y3);
			
			worldHeight = ContSpl.solve(Cont)[0] * 100;

			return worldHeight;
		}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions