Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Creating three quarter circle on editor(Drawing special curved form on editor)
Creating three quarter circle on editor [message #1802662] Wed, 13 February 2019 14:03 Go to next message
Stefan Mayer is currently offline Stefan MayerFriend
Messages: 2
Registered: February 2019
Junior Member
Hello everyone,

I need to give the user the option du create a curvedConnection that looks like a three quarter circle.

We also did this for the quarter and semi circle without problems.
Here is what we did to draw the semi circle:

We use the method Graphiti.getPeCreateService().createCurvedConnection(double[] controllPoints, Diagram diagram).
To create the controllPoints we use a simple static method:

	public static double[] getControlPointsForSemiCircle(double radius) {

		double point1X = 0.0;
		double point1Y = radius / 2;

		double point2X = 0.25;
		double point2Y = radius;

		double point3X = 0.75;
		double point3Y = radius;

		double point4X = 1.0;
		double point4Y = radius / 2;

		double[] controlPoints = new double[] {point1X, point1Y, point2X, point2Y, point3X, point3Y, point4X, point4Y};
		return controlPoints;
	}


for this curve we create a solid polyline.
The result is as following

index.php/fa/34877/0/

I tried some approaches like setting two additional points for the three quarter circle that move the line backwards or the following idea with 4 controllpoints like it would be drawn in a normal coordinate system

public static double[] getControlPointsForThreeQuarterCircle(double radius) {

		double point1X = 0; // 0
		double point1Y = 0; // 0

		double point2X = (Math.sqrt(2) * radius) / 100; // 0.5
		double point2Y = -Math.sqrt(2) * radius; // -50

		double point3X = (Math.round(2 * Math.sqrt(2) * radius)) / 100; // 1.01
		double point3Y = 0;

		double point4X = (Math.sqrt(2) * radius) / 100; // 0.5
		double point4Y = Math.sqrt(2) * radius; // 50

		double[] controlPoints = new double[] {point1X, point1Y, point2X, point2Y, point3X, point3Y, point4X, point4Y};
		return controlPoints;
	}


What I want is something like that (Hard to draw it in paint but you know what I mean^^)
index.php/fa/34878/0/

what I get is always a scary form like that
index.php/fa/34879/0/

I think the editor has a hard time to draw in negative x direction. Is there any approach to resolve this issue and draw forms like a three quarter circle?

Thanks for your help. I hope this is the right forum for this topic. Sorry if not :)

greetings Stefan
Re: Creating three quarter circle on editor [message #1821612 is a reply to message #1802662] Mon, 17 February 2020 11:04 Go to previous message
Stefan Mayer is currently offline Stefan MayerFriend
Messages: 2
Registered: February 2019
Junior Member
Hallo zusammen,

kann mir inzwischen jemand helfen?

Mit freundlichen Grüßen
Stefan
Previous Topic:Online Help (Documentation) has disappeared
Next Topic:Constrain size of Canvas
Goto Forum:
  


Current Time: Fri Apr 19 22:52:21 GMT 2024

Powered by FUDForum. Page generated in 0.02956 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top