How to find Length and Breadth of a Rectangle represented by co-ordinates?
example:rectang le represented by (a,b) (c,d) (e,f) (g,h)
4 3113 Dormilich 8,658
Recognized Expert Moderator Expert
you can do it vector-like by computing the absolute of adjacent points - x = | ⎛a⎞ – ⎛c⎞ |
-
| ⎝b⎠ ⎝d⎠ |
-
-
// x, =, – should be in the middle
hi Dormilich,
can you please explain your solution a bit.
Thanks,
Sekhar
jkmyoung 2,057
Recognized Expert Top Contributor
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
Glenton 391
Recognized Expert Contributor
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jack |
last post by:
Hello,
What function can get a string's long by JavaScript?
Thank you
|
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 object.
Rectangle myRec = new Rectangle(0, 0, 2, 2);
If you draw this rectangle on the screen you will end up with a rectangle
like the one shown below (The character "X" represents a pixel used to draw
the rectangle and the character "O" is...
|
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 store each line into a list, is this possible?
Please send mail to me at nickyncy@yahoo.com.hk or reply this mail
Thanks a lot!
|
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 (&context, input, len);
// void MD5Update (MD5_CTX *context, unsigned char *input, unsigned
|
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 / -maxdepth 3 -size -100k -type f -exec grep -sli pythonpath '{}' \;
The minus in '-100k' (meaning "less than 100k") seems to be
| |
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)
{
int width = 0;
|
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 data in the field is nonzero, it
is not displaying anything if the filed is mty in table..
I cant understand y it is displaying the length as 0 , bcaz i want to
|
by: mmkhan7 |
last post by:
could any one tell me how can i find length of given string in VB
|
by: mihiri |
last post by:
Can we use array.length when we dont know lengt of array.I use C language
|
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 locate the postion and determine
the size fo the white rectangle and then crop the image to leave only the
white rectangle remaining.
I'm very new to GDI+ and have really no idea where to start. Can anyone
suggest a good way to accomplish this?
...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |