rectangles

Render an outlined red rectangle on top a 2D texture in OpenGL

亡梦爱人 提交于 2019-12-02 06:30:32
I have searched alot this site but couldn't exactly find what is exactly my problem. Most of the similar problems had used console and the glut library. But since I'm new to OpenGL and MFC and started it with the combination of MFC, they couldn't help me alot. I'm customizing the class COpenGLcontrol here in codeguru for my own purposes. Here's the full customized class but if you're not interested in downloading it, no problem I will explain the parts that are related. This may take a while, so I hope you will be patient! First of all I should tell you that my goal of drawing such a rectangle

Count the number of adjacent boxes

最后都变了- 提交于 2019-12-01 17:08:17
Suppose I have a set of (X,Y) coordinates of 1000 boxes. ( x1, y1) ( x2, y2) Area (0.0000,0.0000) (0.3412,0.4175) 0.1424 (0.7445,0.0000) (1.0000,0.6553) 0.1674 (0.7445,0.6553) (1.0000,1.0000) 0.0881 (0.0000,0.6553) (0.7445,1.0000) 0.2566 (0.3412,0.0000) (0.7445,0.4175) 0.1684 (0.3412,0.4175) (0.7445,0.6553) 0.0959 (0.0000,0.4175) (0.3412,0.6553) 0.0812 ....etc I would like to calculate the number of adjacent boxes for each of them using c/c++ . How can I do it? Example In this picture, the total number of adjacent boxes for box-7 is six, for box-3 is three. How can I count them using c++?

How to properly clear or update a drawn rectangle on the screen

狂风中的少年 提交于 2019-12-01 13:08:22
I'm using a semi-transparent Form to capture the mouse events such as LeftButtonDown , LeftButtonUp and MouseMove to be able to select an area on the screen to draw a rectangle on that area, the problem is that a new rectangle is drawn every time that I move the mouse producing an annoying result like this: I just would like to update the drawn rectangle when I move the mouse to the new mouse location to expect a result like this else: I've tried to dispose, clear, and re-instance the Graphics object without luck, also I've seen this S.O. question that talks about this. This is the relevant

How to properly clear or update a drawn rectangle on the screen

雨燕双飞 提交于 2019-12-01 12:39:12
问题 I'm using a semi-transparent Form to capture the mouse events such as LeftButtonDown , LeftButtonUp and MouseMove to be able to select an area on the screen to draw a rectangle on that area, the problem is that a new rectangle is drawn every time that I move the mouse producing an annoying result like this: I just would like to update the drawn rectangle when I move the mouse to the new mouse location to expect a result like this else: I've tried to dispose, clear, and re-instance the

How to draw a rectangle in WPF at a specific x,y screen location?

青春壹個敷衍的年華 提交于 2019-12-01 03:47:06
In C#, WPF I've created a rectangle: Rectangle myRgbRectangle = new Rectangle(); myRgbRectangle.Width = 1; myRgbRectangle.Height = 1; SolidColorBrush mySolidColorBrush = new SolidColorBrush(); Yes, I really just want it to be 1 pixel by 1 pixel. And I want to change the color based on the variable height like so: mySolidColorBrush.Color = Color.FromArgb(255, 0, 0, (byte)height); myRgbRectangle.Fill = mySolidColorBrush; Now, how do I draw at a specific x,y location on the screen? I do have a grid (myGrid) on my MainWindow.xaml. Thanks! Here's the pertinent code: myRgbRectangle.Width = 1;

How determine if point is within rectangle given all latitude/longitude coordinates?

倖福魔咒の 提交于 2019-12-01 00:51:03
If given x/y coordinates for all 4 corners of rectangle, and then another x/y, it's easy to determine if the point is within the rectangle if top left is 0,0. But what if the coordinates are latitude/longitude where they can be negative (please see attached). Is there a formula that can work in this case? Mathematicaly, you could use inequations to determine that. edit: When doing the example, i've noticed you put the coordinates in the inverse format (y,x) instead of (x,y). In my example I use (x,y) format, so I just inverted the order to easy my explanation. Let's say A = (-130,10) B = (-100

Hebrew text showing rectangle in iOS on UIlabel?

て烟熏妆下的殇ゞ 提交于 2019-11-30 23:40:58
I have hebrew text and when I am showing on UILabel it showing some rectangle. please help. Actual Text :- בָּרוּךְ אַתָּה יְיָ, אֱלֹהֵֽינוּ מֶֽלֶךְ הָעוֹלָם, בּוֹרֵא פְּרִי הָעֵץ out put :- UPDATE :- I have created the UILabel Manually using storyboard xib and set font name and rectangles gone but when i using on programatically created UILabel it is not working.I double checked Font Name is fine .Any idea? Font is :- Arial Hebrew(family name) ArialHebrew-Bold (font name) ArialHebrew (font name) Please check by mistake if you would be setting the system font size or font name again then it's won't

Packing rectangles for compact representation

做~自己de王妃 提交于 2019-11-30 21:23:06
I am looking for pointers to the solution of the following problem: I have a set of rectangles, whose height is known and x-positions also and I want to pack them in the more compact form. With a little drawing (where all rectangles are of the same width, but the width may vary in real life), i would like, instead of. -r1- -r2-- -r3-- -r4- -r5-- something like. -r1- -r3-- -r2-- -r4- -r5-- All hints will be appreciated. I am not necessarily looking for "the" best solution. Your problem is a simpler variant, but you might get some tips reading about heuristics developed for the "binpacking"

How to arrange N rectangles to cover minimum area [duplicate]

不问归期 提交于 2019-11-30 20:48:20
Possible Duplicate: Algorithm needed for packing rectangles in a fairly optimal way I have N rectangles, each of a random size (random width & height). All rectangles are parallel to the X & Y axes. I'm looking for an algorithm that helps me arrange these rectangles side-by-side in a way that the resulting bounding rectangle has minimum area and the potential gaps around / between the input rectangles are as small as possible. Rectangles cannot be rotated and may not overlap each other. (I need these to automate the arrangement of game sprites so I can create sprite sheets and save sprite

How determine if point is within rectangle given all latitude/longitude coordinates?

做~自己de王妃 提交于 2019-11-30 19:09:08
问题 If given x/y coordinates for all 4 corners of rectangle, and then another x/y, it's easy to determine if the point is within the rectangle if top left is 0,0. But what if the coordinates are latitude/longitude where they can be negative (please see attached). Is there a formula that can work in this case? 回答1: Mathematicaly, you could use inequations to determine that. edit: When doing the example, i've noticed you put the coordinates in the inverse format (y,x) instead of (x,y). In my