float y2 = nodeTo.y();
float x1 = nodeFrom.x();
float y1 = nodeFrom.y();
//Edge vector
Vec2f edgeVector = new Vec2f(x2 - x1, y2 - y1);
edgeVector.normalize();
//Get collision distance between nodeTo and arrow point
double angle = Math.atan2(y2 - y1, x2 - x1);
if (nodeTo.getModel() == null) {
return;
}
float collisionDistance = ((ModelImpl) nodeTo.getModel()).getCollisionDistance(angle);
//Point of the arrow
float targetX = x2 - edgeVector.x() * collisionDistance;
float targetY = y2 - edgeVector.y() * collisionDistance;
//Base of the arrow
float baseX = targetX - edgeVector.x() * arrowHeight * 2f;
float baseY = targetY - edgeVector.y() * arrowHeight * 2f;
//Side vector
float sideVectorX = y1 - y2;
float sideVectorY = x2 - x1;
float norm = (float) Math.sqrt(sideVectorX * sideVectorX + sideVectorY * sideVectorY);