Hi,
Given a line segment L1 endpoints (x1, y1), (x2, y2), and distance D.
I want to generate a new line segment L2 such that L2 is parallel to
L1 and the distance between L1 and L2 is D.
Thank you. 8 7751
> Given a line segment L1 endpoints (x1, y1), (x2, y2), and distance D. I want to generate a new line segment L2 such that L2 is parallel to L1 and the distance between L1 and L2 is D.
Those 4 points you have define a slope for the line L1
m1 = (y2 - y1) / (x2 - x1);
The line L2 will have the same slope, I haven't thought this out too
carefully but I believe the only difference (in slope-intercept form) will
be the intercept, which can differ by D to distance the lines apart.
--
Jem Berkes http://www.sysdesign.ca/
Jem Berkes wrote: Given a line segment L1 endpoints (x1, y1), (x2, y2), and distance D. I want to generate a new line segment L2 such that L2 is parallel to L1 and the distance between L1 and L2 is D.
Those 4 points you have define a slope for the line L1 m1 = (y2 - y1) / (x2 - x1);
That's not a good idea. The slope may become infinite.
given
P1 ( x1, y1 )
P2 ( x2, y2 )
D
wanted
P3
P4
such that the distance from P3 to P1 equals D and
the distance from P4 to P2 equals D and
the line connecting P3 and P1 is perpendicular to the line P2 - P1 and
the line connection P4 and P2 is perpendiculat to the line P2 - P1 and
P3 and P4 or on the same side of the line P2 - P1
(make a drawing, all of the above are obvious from the drawing, but its
hard to describe and understand it in text form only)
Calulate:
P2 - P1, that is
dx = x2 - x1;
dy = y2 - y1;
a vector perpendicular to P2-P1 has the parameters
perp_x = dy
perp_y = -dx;
thus you just need to normalize this
len = sqrt( perp_x * perp_x + perp_y * perp_y );
perp_x /= len;
perp_y /= len;
and multiply with the desired distance
perp_x *= D;
perp_y *= D;
The points P3 and P4 are then:
P3 = P1 + perp
that is: x3 = x1 + perp_x
y3 = y1 + perp_y
P4 = P4 + perp
that is x4 = x2 + perp_x
y4 = y2 + perp_y
the line P4-P3 is parallel to P2-P1 with the given distance D
--
Karl Heinz Buchegger kb******@gascad.at
Shamli wrote: Hi, Given a line segment L1 endpoints (x1, y1), (x2, y2), and distance D. I want to generate a new line segment L2 such that L2 is parallel to L1 and the distance between L1 and L2 is D. Thank you.
Insufficient information to creeate a unique set (x3,y3), (x4,y4). There
are an infinite number of such pairs that produce a line parallel to L1
at a distance D from it.
For example, which do you want form the below drawings?
/ /
/ /
/ /
or
/
/ /
/ /
/
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Common User Interface Services
M/S 2R-94 (206)544-5225
Shamli wrote: Hi, Given a line segment L1 endpoints (x1, y1), (x2, y2), and distance D. I want to generate a new line segment L2 such that L2 is parallel to L1 and the distance between L1 and L2 is D. Thank you.
What is the topology of the surface?
/david
--
Andre, a simple peasant, had only one thing on his mind as he crept
along the East wall: 'Andre, creep... Andre, creep... Andre, creep.'
-- unknown
Karl Heinz Buchegger wrote:
[snip] given P1 ( x1, y1 ) P2 ( x2, y2 ) D
wanted P3 P4
such that the distance from P3 to P1 equals D and the distance from P4 to P2 equals D and the line connecting P3 and P1 is perpendicular to the line P2 - P1 and the line connection P4 and P2 is perpendiculat to the line P2 - P1 and
Why perpendicular? For example, a parallelogram with width D is a model
of the solution, but D is not necessarily the length a line segment
perpendicular to the sides.
/david
--
Andre, a simple peasant, had only one thing on his mind as he crept
along the East wall: 'Andre, creep... Andre, creep... Andre, creep.'
-- unknown
David Rubin wrote: Karl Heinz Buchegger wrote:
[snip] given P1 ( x1, y1 ) P2 ( x2, y2 ) D wanted P3 P4
such that the distance from P3 to P1 equals D and the distance from P4 to P2 equals D and the line connecting P3 and P1 is perpendicular to the line P2 - P1 and the line connection P4 and P2 is perpendiculat to the line P2 - P1 and
Why perpendicular?
Because given a line segement, constructing another line segment which is
perpendicular to it, is trivial.
For example, a parallelogram with width D is a model of the solution, but D is not necessarily the length a line segment perpendicular to the sides.
True.
But if the sides are perpendicular to the base line and the line segments
have length D, then their endpoints P3/P4 form a line segment parallel to P2-P1
at the desired distance D.
The goal was to create a parallel line, how to do that is left to me :-)
--
Karl Heinz Buchegger kb******@gascad.at
Karl Heinz Buchegger wrote: David Rubin wrote: Karl Heinz Buchegger wrote:
[snip] given P1 ( x1, y1 ) P2 ( x2, y2 ) D wanted P3 P4
such that the distance from P3 to P1 equals D and the distance from P4 to P2 equals D and the line connecting P3 and P1 is perpendicular to the line P2 - P1 and the line connection P4 and P2 is perpendiculat to the line P2 - P1 and
Why perpendicular?
Because given a line segement, constructing another line segment which is perpendicular to it, is trivial.
That is: in euclidian space :-) For example, a parallelogram with width D is a model of the solution, but D is not necessarily the length a line segment perpendicular to the sides.
True. But if the sides are perpendicular to the base line and the line segments have length D, then their endpoints P3/P4 form a line segment parallel to P2-P1 at the desired distance D.
The goal was to create a parallel line, how to do that is left to me :-)
--
Karl Heinz Buchegger kb******@gascad.at
David Rubin wrote: Karl Heinz Buchegger wrote:
[snip] given P1 ( x1, y1 ) P2 ( x2, y2 ) D
wanted P3 P4
such that the distance from P3 to P1 equals D and the distance from P4 to P2 equals D and the line connecting P3 and P1 is perpendicular to the line P2 - P1 and the line connection P4 and P2 is perpendiculat to the line P2 - P1 and
Why perpendicular? For example, a parallelogram with width D is a model of the solution,
Oops. Sorry.
I misread this sentence.
To answer: No, a general parallelogram is not a model of the solution.
I nail the inner angles down to 90 degrees (hence P3-P1 is perpendicular
to P2-P1) and thus create a rectangle.
--
Karl Heinz Buchegger kb******@gascad.at This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ryan Lowe |
last post by:
maybe its just me, but the behavior of parallel lists in for loops seems
backwards. why doesnt it mirror parallel assignment? i think tuple-unpacking
should take precedence, but instead iteration...
|
by: paytam |
last post by:
Hi all,
Is it possible to write parallel programming in C?
I mean for example a simple program like I have a clock on a program
that show me current time and and at the same time another job like...
|
by: lovecreatesbeauty |
last post by:
For example, line L1 and line L2 are two lines in two-dimensional
space, the start-points and end-points can be described with following
the `point_t' type. The start-points and end-points are:...
|
by: Chris Smith |
last post by:
Howdy,
I'm a college student and for one of we are writing programs to
numerically compute the parameters of antenna arrays. I decided to use
Python to code up my programs. Up to now I haven't...
|
by: sesling |
last post by:
I currently use an SQL command line that utilizes parallel threads. ex.
select /*+ PARALLEL (ACCOUNT 20) */ Account_ID, Customer_Name, Add_Date from Customer_Info. By running this query using...
|
by: parallelpython |
last post by:
Has anybody tried to run parallel python applications?
It appears that if your application is computation-bound using 'thread'
or 'threading' modules will not get you any speedup. That is because...
|
by: gunimpi |
last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431
********************************************************
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
wanted...
|
by: Okonita via DBMonster.com |
last post by:
Hi all,
I am comming along with all this Linus/DB2/scripting business...I am no
longer scared of it!! (LOL). But,
I need to create a .ksh script that does a REORGCHK and output only tables...
|
by: Prime Mover |
last post by:
Hello all,
I have got the pseudo-code below that I would like to convert to c
language. The algorithm calculates Pi value. I am somewhat familiar
with C language, but I am just starting to learn...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
|
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...
| |