Questions tagged [rectangles]

A rectangle is a geometric shape: any quadrilateral with four right angles

1373 questions
-2
votes
1 answer

Two ArrayList in run() method Collision Detection

i have problem with checking collision with 2 arraylist that updating in run() method. here is my code in run() method: ArrayList enemy = addenemy.getEnemy(); for (int i = 0; i < enemy.size(); i++) { Enemy p = (Enemy)…
-2
votes
1 answer

Cover large rectangles with identical small rectangles

The problem states that I have a big rectangle, with dimension L and W, and unlimited number of identical small rectangles, with dimension l and w. L * W is guaranteed to be larger than l *w. So I want to find out the maximum number of small…
MathCs
  • 185
  • 1
  • 1
  • 10
-3
votes
1 answer

To print below hollow pattern of given dimension on basis of input

Input Format rows = 6, columns = 20; Constraints n>0 Output Format image Sample Input 0 6 20 Sample Output 0 ******************** * * * * * * *…
-3
votes
1 answer

Constructing Rectangular with Python

Is there any way to make area() refer to check()? Currently, codes of check() is the same in area(). class Rectangle: def __init__(self, x1, y1, x2, y2): self.x1 = x1 self.x2 = x2 self.y1 = y1 self.y2 = y2 …
신은화
  • 3
  • 3
-3
votes
1 answer

I need to Draw a rectangle over image with touch event

I need to draw a rectangle over an image so that user can select a specific part of that image when the user selects a rectangular part must be drawn over it. for example say if the user wants click image if a parking lot then user can draw…
-3
votes
1 answer

JavaFX does not render properly, but my basic code is probably wrong

I was coding a simple shape-collision-detector, but I noticed the rectangle which I move using the mouse vanishes in some window's areas. I can't figure out why. Here you can see the video and below the code I used. Any advice? Rectangle r = new…
-3
votes
3 answers

Drawing box around message

I'm working on this Python task that I can't figure out. It is the last of 3 functions and the first 2 were much easier to program then this one. The instructions are "Given a message that may contain multiple lines, utilize the split() function to…
famguy74
  • 27
  • 3
  • 11
-3
votes
2 answers

Given four Corner vertices of a rectangle, how to identify all upper and lower (left & right) corner points?

Four Corner Vertices of a deformed rectangle are given i.e. p1(x1,y1), p2(x2,y2), p3(x3,y3) & p4(x4,y4). How to find position of all co-ordinates i.e. which one is upper left, upper right, lower right and lower left? I am working with MATLAB.…
erbal
  • 421
  • 5
  • 18
-3
votes
1 answer

make Ball bounce off object edges in C

I am trying to make a ball bounce off the edges of a rectangular shaped paddle, what I have done so far, is making the ball bounce off the top edge of the paddle. But whenever the ball touches any other side (right or left), it gets stuck within the…
Yamen Tawk
  • 67
  • 3
  • 10
-3
votes
1 answer

How to fix method error

I just want to make sure I'm correct here. I am trying to add methods to Change height Change width Change coordinates Calculate perimeter Calculate area public class MyRectangle { public int width; public int height; public int y; public int…
Sunny Dhillon
  • 81
  • 1
  • 1
  • 8
-3
votes
1 answer

Inheritance of Square method in java

I have a class Rectangle laid out like this: package Inheritance; /** * * @author Jacob */ public class Rectangle { final private int length; final private int width; public Rectangle (int l, int w) { length = l; width = w; } public…
user3440443
  • 13
  • 2
  • 8
-3
votes
1 answer

How to make a Java Rectangle move at an angle

I'm a new game developer and I have always wondered about how would I go about making a 'Rectangle' object move at a certain angle? I thought I could make the x increase rapidly and the y increase at a delay, but how would I do that?
user3670816
  • 17
  • 1
  • 7
-3
votes
2 answers

CHANGE the size of a rectangle?

I need to change the size of a rectangle when something happens. This is C# if (face1.Y > 440) { rndLocation(); //rectangle size changes }
user3103552
  • 1
  • 2
  • 4
-3
votes
1 answer

Find the boundary of a polygon (or a staircase) c++

I'm doing an 2D bin packing algorithm. The goal is to put a set of rectangle into a bin one by one. At each rectangle insertion, i want to update the boundary between occupied area and free area. Thus, i'm looking for an algorithm or the way to do…
Bryan
  • 31
  • 6
-3
votes
2 answers

Java 2D game, Both of my rectangles are moving when only one should move

I have coded a simple Java game where there are two rectangles on the screen, one of the rectangles should move and the other should stays still, the moving Rectangle moves with keyboard arrow input and can move either up, down, left or right. The…
Rahul Khosla
  • 349
  • 9
  • 21
1 2 3
91
92