Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when rotating to horizontal #39

Closed
rmcdouga opened this issue Jun 7, 2021 · 2 comments
Closed

Problem when rotating to horizontal #39

rmcdouga opened this issue Jun 7, 2021 · 2 comments

Comments

@rmcdouga
Copy link

rmcdouga commented Jun 7, 2021

I'm seeing an issue when I run the following test:

	@Test
	void testSvgProblem() throws Exception {
		SVGGraphics2D g2 = new SVGGraphics2D(4986, 3216);

		int marker_size = 65;
		int local_diameter = 600;
		int radius = local_diameter/2;
		double arc_size = Math.PI / 12;
		
		g2.translate(1000, 500);
		
		g2.setColor(Color.BLUE);
		g2.setStroke(new BasicStroke(2));
		g2.drawOval(-radius, -radius, local_diameter, local_diameter);
		
		// draw sector lines
		g2.drawLine(0, -radius - marker_size / 2, 0, -radius + marker_size / 2);

		g2.rotate(arc_size*2);	// rotate past the orbit arc
		
		// draw sector lines
		int halfMarkerSize = marker_size / 2;
		g2.drawLine(0, -radius - halfMarkerSize, 0, -radius + halfMarkerSize);
		
		for (int i = 0; i < 6; i++) {
			g2.rotate(arc_size);
			g2.drawLine(0, -radius - halfMarkerSize, 0, -radius + halfMarkerSize);
			g2.drawString(Integer.toString(i), 0, -radius);
		}
	
		String result = g2.getSVGDocument();
		Files.writeString(TestConstants.ACTUAL_RESULTS_DIR.resolve("TestSvgProblem.svg"), result);
	}

It creates a circle and then creates a series of lines that are perpendicular to the circle. When the line is horizontal (as in line 3), the transformation matrix looks like it is incorrect.

@jfree
Copy link
Owner

jfree commented Jun 7, 2021

Does this happen with version 4.2? I think it is probably related to #35 which is fixed for the next release. I have a couple more things to tidy up then version 5.0 will be released. For now I would recommend to drop back to version 4.1.

@rmcdouga
Copy link
Author

rmcdouga commented Jun 7, 2021

You're correct. This happens in 4.2 but does not in 4.1.

I have backed off to 4.1 for now. Thanks for the help!

@rmcdouga rmcdouga closed this as completed Jun 7, 2021
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

No branches or pull requests

2 participants