Creating three quarter circle on editor [message #1802662] |
Wed, 13 February 2019 09:03  |
Eclipse User |
|
|
|
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

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^^)

what I get is always a scary form like that

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
|
|
|
|
Powered by
FUDForum. Page generated in 0.02869 seconds