473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to find Length and Breadth of a Rectangle represented by co-ordinates

How to find Length and Breadth of a Rectangle represented by co-ordinates?
example:rectangle represented by (a,b) (c,d) (e,f) (g,h)
May 12 '10 #1
4 3105
Dormilich
8,658 Expert Mod 8TB
you can do it vector-like by computing the absolute of adjacent points
Expand|Select|Wrap|Line Numbers
  1.  x = | ⎛a⎞ – ⎛c⎞ |
  2.      | ⎝b⎠   ⎝d⎠ |
  3.  
  4. // x, =, – should be in the middle
May 12 '10 #2
hi Dormilich,
can you please explain your solution a bit.
Thanks,
Sekhar
May 13 '10 #3
jkmyoung
2,057 Expert 2GB
Find the length of (a,b) to (c,d)
Find the length of (c,d) to (e,f)

One is the length and the second is the breadth
May 13 '10 #4
Glenton
391 Expert 256MB
Do you know whether the points are in order? (a,b) to (c,d) might be a diagonal?
Do you know whether the points are, in fact, a rectangle?

If you know that it's a rectangle, but don't know what order the points are in, you could find three lengths from (a,b) to the other three points
{hint: length = sqrt((a-c)^2+(b-d)^2)}
and then the shortest is the breadth, the middle is the length and the longest is the diagonal.
May 19 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jack | last post by:
Hello, What function can get a string's long by JavaScript? Thank you
3
by: | last post by:
I am having a hard time understanding the logic behind the Rectangle object. My problem has to do with the way the rectangle treats the "Width" property. For example, take the following rectangle...
9
by: News | last post by:
I am new in using Python Anyone know how to implement breadth first search using Python? Can Python create list dynamically, I want to implement a program which will read data from a file and...
4
by: cdrom205 | last post by:
static void MDString ( unsigned char *input) { MD5_CTX context; unsigned char digest; unsigned int len = sizeof(input);//strlen (const char*) md5.MD5Init (&context); md5.MD5Update...
2
by: John J. Lee | last post by:
OK, this is really a reminder to myself next time I forget where I set my PYTHONPATH and forget exactly how to invoke the GNU "find" command ;-) Hope somebody else finds it useful too find /...
6
by: finerrecliner | last post by:
hey everyone i'm trying to make a function that will return the length and width of a dynamically allocated 2D array. here's what i came up with to find width: int findWidth(int** matrix)...
2
by: SSG | last post by:
In my database table , I have field to store the text,.. I am tryinf to find the length of the filed in ASP like below response.write len(rs("cname1")) It is displaying the value , when the...
2
by: mmkhan7 | last post by:
could any one tell me how can i find length of given string in VB
17
by: mihiri | last post by:
Can we use array.length when we dont know lengt of array.I use C language
10
by: sklett | last post by:
I have a situation where I'm getting in Image that has a gray (solid, same color) background with a smaller white rectangle inside. The position is not always the same. What I need to do is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.