D
D
Dmitry Smerks2018-11-16 06:02:15
Java
Dmitry Smerks, 2018-11-16 06:02:15

How to extend a line in java?

There is an object on the field, Circle with constant coordinates. When the user clicks on the screen, a line goes from the X and Y Circle and connects the clicked point to the center of the circle, there are many such lines. The problem lies in the fact that we need to extend the line and take it off the user's screen. And most importantly, the lengths of all these lines that go beyond the screen must be equal. This is where the whole problem lies. I don't know how to describe this, please help.5bee327f7cc64707230916.jpeg

public boolean onTouchEvent(MotionEvent event) {

        int eventAction = event.getAction();

        if (eventAction == MotionEvent.ACTION_MOVE) {
            EndLx = 0;
            EndLx = 0;
            EndLx += (EndLx - PlayerX) ; 
            EndLy += (EndLy - PlayerY) ;
        }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question