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

[Enhancement] Change the arrow of Generalization Line to hollow (outline) #11

Open
Tracked by #2
1chooo opened this issue Jun 13, 2024 · 0 comments
Open
Tracked by #2
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@1chooo
Copy link
Owner

1chooo commented Jun 13, 2024

Change the arrow to hollow (outline), ensuring the line does not pass through the arrow.

// TODO: Change the arrow to hollow (outline), ensuring the line does not pass through the arrow.
public void draw(Graphics g) {
int width = 10, height = 10;
int dx = x2 - x1, dy = y2 - y1;
double D = Math.sqrt(dx * dx + dy * dy);
double xm = D - width, xn = xm;
double ym = height, yn = -height;
double x;
double sin = dy / D, cos = dx / D;
x = xm * cos - ym * sin + x1;
ym = xm * sin + ym * cos + y1;
xm = x;
x = xn * cos - yn * sin + x1;
yn = xn * sin + yn * cos + y1;
xn = x;
int[] xpoints = { x2, (int) xm, (int) xn };
int[] ypoints = { y2, (int) ym, (int) yn };
g.drawLine(x1, y1, x2, y2);
g.drawPolygon(xpoints, ypoints, 3);
}

@1chooo 1chooo added bug Something isn't working enhancement New feature or request labels Jun 13, 2024
@1chooo 1chooo self-assigned this Jun 13, 2024
@1chooo 1chooo changed the title [Enhancement] Change the arrow of General to hollow (outline) [Enhancement] Change the arrow of Generalization Line to hollow (outline) Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant