0

I am creating and using Line2D in Java . I am wondering what Java data type I would use here? Instead of [any points on the line]? Or should I be doing some other logic?

if (object.yPosition >= [any points on the line] ) 
    {
        object.yPosition = line.Y_Position; OR object.xPosition = line.x_Position; //set object position = incoming point of interception
        object.Speed = - object.Speed+1; //then reverse incoming object speed
}
  • Maybe something like [this](http://stackoverflow.com/questions/13261767/java-ball-object-doesnt-bounce-off-of-drawn-rectangles-like-its-supposed-to/13263022#13263022) – MadProgrammer Nov 02 '15 at 02:30
  • either distance PointToLine < smallValue or distanceToLineSegment. – AlexWien Nov 02 '15 at 14:28
  • Yes! bounds()! But for a line? I've found : Line2D.method (PathIterator getPathIterator(AffineTransform at)) "Returns an iteration object that defines the boundary of this Line2D." But I have no idea how to use either PathIterator or AffineTransform data types. Help? – Michael Ireland Nov 02 '15 at 14:43

0 Answers0