AutoCAD Land Desktop (Read Only)
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Slope Intersection

14 REPLIES 14
Reply
Message 1 of 15
Anonymous
354 Views, 14 Replies

Slope Intersection

I am attempting to write a program that will find the intersection to an existing line given a slope from a point.

e.g.
I have a line AB whose points are A(1,1,1) and B(1.99,1.99,1.028) and whose length is 1.414 and slope is 2%.
A point C(2.305,1.045,1.04) does not lie on line AB.
I would like to find where on line AB does a line at 3% from point C ends up.

I would prefer to not use a “trial and error” method of incrementing a point along AB and checking the slope to point C at each increment.

Thanks
Any input would be appreciated.

FYI the solution point X is (1.354,1.354,1.101)
14 REPLIES 14
Message 2 of 15
Anonymous
in reply to: Anonymous

Mal,

 

It's a constant rate of change, so if you calculate
the slopes from C to the 2 line end points, A and B, you can determine
the distance along the line from A to the intersection point at the
required grade.

 

For example, if C to A = 2.65% and C to B is 3.12%,
the total grade diff is 0.47%.

 

The grade diff from A to the required 3% is 0.35%.

 

The distance from A to the intersection point is
(length * 0.35/0.47)

 

 

Glen

 

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
am attempting to write a program that will find the intersection to an
existing line given a slope from a point.

e.g.
I have a line AB whose points are A(1,1,1) and B(1.99,1.99,1.028)
and whose length is 1.414 and slope is 2%.
A point C(2.305,1.045,1.04)
does not lie on line AB.
I would like to find where on line AB does a line
at 3% from point C ends up.

I would prefer to not use a “trial and error” method of incrementing a
point along AB and checking the slope to point C at each increment.

Thanks
Any input would be appreciated.

FYI the solution point X is
(1.354,1.354,1.101)

Message 3 of 15
Anonymous
in reply to: Anonymous

Thanks Glen
Your logic seem sound , It’s simple, and it should work.
But am I missing something.

Based on the coordinates in my sample A(1,1,1) B(1.99,1.99,1.028) C(2.305,1.045,1.04)
Dist AB = 1.40
Slope AB =2%

DistCA = 1.3058
SlopeCA = 3.06%

DistCB = 0.9961
SlopeCB=1.2046%

DistAX ?
SlopeCX = 3%

DistAX = 1.40*(3.0-3.06)/(1.2046-3.06)
DistAX = 0.04527

The distance from A to X should be 0.5 to get a 3% slope from C and not 0.04527

X should be at (1.354,1.354,1.101)
DistAX = 0.5
DistCX = 0.999
SlopeCX=3%

any help would be appreciated
Message 4 of 15
Anonymous
in reply to: Anonymous

Sorry my logic was flawed because the
distance from C to the AB line is not a constant rate of change between A
and B. The length shortens as it moves from A up to the point were it
is perpendicular from C to the line, then it lengthens again to B.

 

I think if that (in this case where the interior
angles at A and C are less then 90) if you find the perpendicular point "D" on
the line, and do the calc from point D to A, so that the line length from C is a
constant rate of change, it should work. I'll try it out and get back to
you.

 

Glen

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Thanks
Glen
Your logic seem sound , It’s simple, and it should work.
But am I
missing something.

Based on the coordinates in my sample A(1,1,1) B(1.99,1.99,1.028)
C(2.305,1.045,1.04)
Dist AB = 1.40
Slope AB =2%

DistCA = 1.3058
SlopeCA = 3.06%

DistCB = 0.9961
SlopeCB=1.2046%

DistAX ?
SlopeCX = 3%

DistAX = 1.40*(3.0-3.06)/(1.2046-3.06)
DistAX = 0.04527

The distance from A to X should be 0.5 to get a 3% slope from C and not
0.04527

X should be at (1.354,1.354,1.101)
DistAX = 0.5
DistCX = 0.999

SlopeCX=3%

any help would be appreciated

Message 5 of 15
Anonymous
in reply to: Anonymous

Mal,

I'm assuming that you've drawn these lines in a profile with an exaggerated
scale? Is that correct? Because:

Delta Y a to b = .99 and Delta X a to b = .99 which gives a slope of 100%
strictly speaking.

So is your scale exaggerated 50:1?

Anyway, I don't get your solution either (1.354, 1.354, 1.101). However, I
didn't pay attention to the Z axis as I'm not convinced it matters (from
what you've told us). I get a solution of X(4.825, 4.825, ?). Without
exaggerating the scale I drew your first line AB (S=100%) and a line from C
@ S=150% (which would be 3% if scale was exaggerated) and that is how I got
the X point. I calculated this point first using math functions.

Also, your line XC indicates a slope of -3% and not 3%. Stuff like that
matters. The point I got for a -3% was X(-1.20625,-1.20625,?).

Are you sure your point X is correct? It seems to me that you calculated
this point based on 3% without exaggerating the scale of the x,y
coordinates. If not, what is the exaggeration on your profile. Where are
the points coming from (x,y axis or stations and elevations?)

I'd like to try and help, but I need to understand exactly how you are
calculating your points.

Jeff
--
Jeff Spannbauer
Civil Engineer III
Cannon Associates
www.cannonassoc.com
805-544-7407




"Mal" wrote in message
news:f0d36ec.1@WebX.maYIadrTaRb...
> Thanks Glen
> Your logic seem sound , It's simple, and it should work.
> But am I missing something.
> Based on the coordinates in my sample A(1,1,1) B(1.99,1.99,1.028)
C(2.305,1.045,1.04)
> Dist AB = 1.40
> Slope AB =2%
>
> DistCA = 1.3058
> SlopeCA = 3.06%
>
> DistCB = 0.9961
> SlopeCB=1.2046%
>
> DistAX ?
> SlopeCX = 3%
>
> DistAX = 1.40*(3.0-3.06)/(1.2046-3.06)
> DistAX = 0.04527
>
> The distance from A to X should be 0.5 to get a 3% slope from C and not
0.04527
>
> X should be at (1.354,1.354,1.101)
> DistAX = 0.5
> DistCX = 0.999
> SlopeCX=3%
>
> any help would be appreciated
>
>
Message 6 of 15
Anonymous
in reply to: Anonymous

Jeff,

 

Mal was discussing plan elements with
northing/easting/elevation coordinates. In drawing it out with COGO Points I was
able to verify her solution but I'm not sure how to calc the solution, my
initial idea didn't work.

 

Glen

  

 

> Mal,
>

>  I'm assuming that you've drawn these lines in a profile with an
exaggerated
> scale?  Is that correct?  Because:
>

> Delta Y a to b = .99 and Delta X a to b = .99 which gives a slope of
100%
> strictly speaking.
>
> So is your scale exaggerated
50:1?
>
> Anyway, I don't get your solution either (1.354, 1.354,
1.101).  However, I
> didn't pay attention to the Z axis as I'm not
convinced it matters (from
> what you've told us).  I get a solution
of X(4.825, 4.825, ?).  Without
> exaggerating the scale I drew your
first line AB (S=100%) and a line from C
> @ S=150% (which would be 3% if
scale was exaggerated) and that is how I got
> the X point.  I
calculated this point first using math functions.
>
> Also, your
line XC indicates a slope of -3% and not 3%.  Stuff like that
>
matters.  The point I got for a -3% was X(-1.20625,-1.20625,?).
>

> Are you sure your point X is correct?  It seems to me that you
calculated
> this point based on 3% without exaggerating the scale of the
x,y
> coordinates.  If not, what is the exaggeration on your
profile.  Where are
> the points coming from (x,y axis or stations
and elevations?)
>
> I'd like to try and help, but I need to
understand exactly how you are
> calculating your points.
>
>
Jeff
> --
> Jeff Spannbauer
> Civil Engineer III
>
Cannon Associates
>

face=Arial size=2>www.cannonassoc.com

>
805-544-7407
>
>
>
>
> "Mal" <

href="mailto:mfernandes@stantec">
size=2>mfernandes@stantec
> wrote in
message
>

face=Arial size=2>news:f0d36ec.1@WebX.maYIadrTaRb

size=2>...
> > Thanks Glen
> > Your logic seem sound , It's
simple, and it should work.
> > But am I missing something.
>
> Based on the coordinates in my sample A(1,1,1) B(1.99,1.99,1.028)
>
C(2.305,1.045,1.04)
> > Dist AB = 1.40
> > Slope AB
=2%
> >
> > DistCA = 1.3058
> > SlopeCA =
3.06%
> >
> > DistCB = 0.9961
> >
SlopeCB=1.2046%
> >
> > DistAX ?
> > SlopeCX =
3%
> >
> > DistAX = 1.40*(3.0-3.06)/(1.2046-3.06)
> >
DistAX = 0.04527
> >
> > The distance from A to X should be
0.5 to get a 3% slope from C and not
> 0.04527
> >
> > X
should be at (1.354,1.354,1.101)
> > DistAX = 0.5
> > DistCX =
0.999
> > SlopeCX=3%
> >
> > any help would be
appreciated
> >
> >
>
>
Message 7 of 15
Anonymous
in reply to: Anonymous

Hi Glen,

OK, I think I'm with you now. The Z axis does matter. I agree that the
line AB has a slope of 2%. However, I don't agree that the line CX has a
slope of 3%. The slope of line CX as I find it is 6.1%.

Am I calculating it right? I get a rise of .061 (which is simply delta Z).
I get a run of .99994 (which is square root of delta X squared + delta Y
squared). Slope is Rise/Run. So for me I get .061/.99994 = 6.1%. I'm
sorry but I have to ask, how did you get a slope of 3% for line CX?

Jeff
--
Jeff Spannbauer
Civil Engineer III
Cannon Associates
www.cannonassoc.com
805-544-7407

"Glen Albert" wrote in message
news:F75406400E562A4DFAB9C398B7B1DEF9@in.WebX.maYIadrTaRb...
> Jeff,
>
> Mal was discussing plan elements with northing/easting/elevation
coordinates. In drawing it out with COGO Points I was able to verify her
solution but I'm not sure how to calc the solution, my initial idea didn't
work.
>
> Glen
>
>
> "Jeff Spannbauer" wrote in message
news:B51CB69C6FC1F856644F1794C7668382@in.WebX.maYIadrTaRb...
> > Mal,
> >
> > I'm assuming that you've drawn these lines in a profile with an
exaggerated
> > scale? Is that correct? Because:
> >
> > Delta Y a to b = .99 and Delta X a to b = .99 which gives a slope of
100%
> > strictly speaking.
> >
> > So is your scale exaggerated 50:1?
> >
> > Anyway, I don't get your solution either (1.354, 1.354, 1.101).
However, I
> > didn't pay attention to the Z axis as I'm not convinced it matters (from
> > what you've told us). I get a solution of X(4.825, 4.825, ?). Without
> > exaggerating the scale I drew your first line AB (S=100%) and a line
from C
> > @ S=150% (which would be 3% if scale was exaggerated) and that is how I
got
> > the X point. I calculated this point first using math functions.
> >
> > Also, your line XC indicates a slope of -3% and not 3%. Stuff like that
> > matters. The point I got for a -3% was X(-1.20625,-1.20625,?).
> >
> > Are you sure your point X is correct? It seems to me that you
calculated
> > this point based on 3% without exaggerating the scale of the x,y
> > coordinates. If not, what is the exaggeration on your profile. Where
are
> > the points coming from (x,y axis or stations and elevations?)
> >
> > I'd like to try and help, but I need to understand exactly how you are
> > calculating your points.
> >
> > Jeff
> > --
> > Jeff Spannbauer
> > Civil Engineer III
> > Cannon Associates
> > www.cannonassoc.com
> > 805-544-7407
> >
> >
> >
> >
> > "Mal" wrote in message
> > news:f0d36ec.1@WebX.maYIadrTaRb...
> > > Thanks Glen
> > > Your logic seem sound , It's simple, and it should work.
> > > But am I missing something.
> > > Based on the coordinates in my sample A(1,1,1) B(1.99,1.99,1.028)
> > C(2.305,1.045,1.04)
> > > Dist AB = 1.40
> > > Slope AB =2%
> > >
> > > DistCA = 1.3058
> > > SlopeCA = 3.06%
> > >
> > > DistCB = 0.9961
> > > SlopeCB=1.2046%
> > >
> > > DistAX ?
> > > SlopeCX = 3%
> > >
> > > DistAX = 1.40*(3.0-3.06)/(1.2046-3.06)
> > > DistAX = 0.04527
> > >
> > > The distance from A to X should be 0.5 to get a 3% slope from C and
not
> > 0.04527
> > >
> > > X should be at (1.354,1.354,1.101)
> > > DistAX = 0.5
> > > DistCX = 0.999
> > > SlopeCX=3%
> > >
> > > any help would be appreciated
> > >
> > >
> >
> >
>
Message 8 of 15
Anonymous
in reply to: Anonymous

The elevation for the solution point is 1.01 and not 1.10
Sorry my apologies

X= (1.354,1.354,1.01)
Message 9 of 15
Anonymous
in reply to: Anonymous

Jeff, Glen and Mal,

I too had to re-read the post several times.

As Jeff has pointed out, the coordinate X (1.354,1.354,1.101) does not lie
on the 3d line between A(1,1,1) and B(1.99,1.99,1.028). Just look at the Z
coordinate for point X and this becomes evident. I believe Mal has a typo -
1.101 instead of 1.01 - if point X is (1.354,1.354,1.01), then, allowing for
a little rounding, the solution does seem to work.

Glen's solution does not work because he assumed a direct lineal
relationship between the slope of the line and the slope to the fixed point,
which is not the case. As Glen pointed out, the distance between the loci of
points on the line to the fixed point is constantly changing, but also the
elevation of the end point along the line is changing, making the
relationship exponential. In fact, the solution should take the form of a
quadratic equation. This is why his proposed linear interpolation to the XY
plane perpendicular also will not work. I find the location of the
perpendicular projected from the fixed point to the line to be
(1.675,1.675,1.0189). This is located .95 from point A, and has a slope of
2.359. When one does a proportional relationship between the slopes over
the distance, one finds that the 3% slope should occur at a distance of
0.085 from Point A. We already know the solution locates it 0.5 from Point
A. In fact, just a quick visual inspection shows a 3.06% slope from C to A,
and any linear relationship would locate a 3.0% slope intersection very
close to A. In fact, we know that it is 0.5' away, over 1/3 of the distance
to point B. In fact, if you sample points along the line from point A to
point B say at 0.2 intervals, you will find the slope actually starts to
increase before it starts to decrease, at that the amount of
increase/decrease is not directly relational to the interval along the line.

Mal, looking at the problem in terms of analytic geometry, you are looking
for the intersection between two Euclidean objects in 3d-space. The first
object describes the loci of points along a 3d line (i.e.; a vector or ray),
The second object is the loci of points that is a constant slope from a
fixed 3d point in space. This is the general definition of a right circular
cone with the 3d-point being the vertex or fixed end of the cone. In your
case the angle between the directrix that sweeps along the cone's surface
and the vertical axis of the cone is the cos(3/100). What we are looking for
is the general equation for a line-cone intersection.

The general form of the equation for a 3d vector is:

AX + BY + CZ + D + E + F = 0

The general form of the equation for a cone is:

X^2 + Y^2 + Z^2 = (A^2/B^2) * X^2

So your problem is to convert the coordinate geometry data into the general
form of the two equations and then solve the simultaneous equations by
matrix or parametric means. I believe that the parametric equations would
reduce to a quadratic form, something like:

(A t^2) + (2B t) + C = 0

Which would be a the quadratic equation that you would have to solve.

For any quadratic equation there could be no solutions, one solution, or two
solutions. To graphically visualize this, we need to look at conic sections.
If we assume the 3d line can represent the fall vector of the plane in-which
it is located. The intersection of a plane and a cone is an ellipse if the
eccentricity of the cone-plane intersection is between 0 and 1. It is a
circle if the plane is perpendicular to the cone's axis. In fact, for this
specific data set, Glen's approach would probably work because the distance
from the line to the fixed point would be constant. It becomes a parabola
if the plane is parallel to the slope (directrix). It becomes a hyperbola
if the plane is parallel to the cone's axis. The intersecting line in the
plane, if the case is a circle or ellipse can be one (if the line goes
through the foci or center) or two solutions. There would be one (or none)
solution if the line lies in a plane perpendicular or parallel to the cone's
axis. So, finding universal solutions for all cases may be evolved.

I apologize, I do not have the time nor readily recallable skills to reduce
the equations to workable parametric forms for you ( it has been ~35 years
since analytic geometry in college). Conic sections should find applications
in satellite orbits, atomic structure, ray-tracing and gaming. It may be
faster (and more reliable) for you to look-up "line-cone intersections", or
"conic sections" on the WEB, or ask the question in a math forum.

To get your started check out:

http://www.magic-software.com/Source/Intersection3D/MgcIntr3DLinCone.cpp

Magic Software provides source code for gamers and visualizers. It has free
source code for all kinds of 3d geometrical problems. This specific page is
a line-cone intersection source code using 'C' routines. You can find
Acrobat documentation for the theory at:

http://www.magic-software.com/Documentation/IntersectLineCone.pdf

For visual theory on conic sections check out:

http://library.thinkquest.org/29033/math/cones.htm

http://www.math2.org/math/algebra/conics.htm

For theory of 3d coordinate geometry check out:

http://www.cs.bham.ac.uk/~slb/sem307/g62.html

There are also very could source books, look for the titles : "Graphics
Gems" and "Introduction to Ray Tracing"

I am sure you will find the solution quite complex. You may eventually
realize that your initial impulse - just a binary tree iterative slope
computations along the divided coordinates of the 3d-line may be the
simplest solution, as long as you realize that no simple direct relation
exists as you sample along the line. I am curious how you plan to use this
tool in an applied civil design scenario...

Good luck, and sorry I can not offer a more specific solution.

sc

Jeff Spannbauer wrote in message
news:CA6851B673F9242D36BC931D13A3BEDB@in.WebX.maYIadrTaRb...
>
>
> Am I calculating it right? I get a rise of .061 (which is simply delta
Z).
> I get a run of .99994 (which is square root of delta X squared + delta Y
> squared). Slope is Rise/Run. So for me I get .061/.99994 = 6.1%. I'm
> sorry but I have to ask, how did you get a slope of 3% for line CX?
>
> Jeff
Message 10 of 15
Anonymous
in reply to: Anonymous

Steve,

Very nicely put and written. I have been lagging on replying because I'm
lazy and didn't want to type all that you did. I couldn't agree with you
more though.

The solution is the intersection of a line and a cone. I got out my old
Calculus book last night and was digging though it for the solution, but
couldn't find it in the 20 minutes that I searched for it (it's been 10
years since I've opened it, lol).

The first web site you gave was good, but looked like a foreign language to
me , and the second one didn't seem directly on the topic.

I'm going to dig again tonight and see if I cant find the solution in a
matrix format. I'm sure it exists. Your parabola idea makes sense to me
though. After all, a parabola is what you get if you cut a cone with a
plane (or slice through it with a line).

Sorry Mal, hard questions require more time 🙂

Jeff
--
Jeff Spannbauer
Civil Engineer III
Cannon Associates
www.cannonassoc.com
805-544-7407

"Steve Cannon" wrote in message
news:D166EBB0A6DD8A2BA9972B2685E72E17@in.WebX.maYIadrTaRb...
> Jeff, Glen and Mal,
>
> I too had to re-read the post several times.
>
> As Jeff has pointed out, the coordinate X (1.354,1.354,1.101) does not lie
> on the 3d line between A(1,1,1) and B(1.99,1.99,1.028). Just look at the
Z
> coordinate for point X and this becomes evident. I believe Mal has a
typo -
> 1.101 instead of 1.01 - if point X is (1.354,1.354,1.01), then, allowing
for
> a little rounding, the solution does seem to work.
>
> Glen's solution does not work because he assumed a direct lineal
> relationship between the slope of the line and the slope to the fixed
point,
> which is not the case. As Glen pointed out, the distance between the loci
of
> points on the line to the fixed point is constantly changing, but also the
> elevation of the end point along the line is changing, making the
> relationship exponential. In fact, the solution should take the form of a
> quadratic equation. This is why his proposed linear interpolation to the
XY
> plane perpendicular also will not work. I find the location of the
> perpendicular projected from the fixed point to the line to be
> (1.675,1.675,1.0189). This is located .95 from point A, and has a slope
of
> 2.359. When one does a proportional relationship between the slopes over
> the distance, one finds that the 3% slope should occur at a distance of
> 0.085 from Point A. We already know the solution locates it 0.5 from
Point
> A. In fact, just a quick visual inspection shows a 3.06% slope from C to
A,
> and any linear relationship would locate a 3.0% slope intersection very
> close to A. In fact, we know that it is 0.5' away, over 1/3 of the
distance
> to point B. In fact, if you sample points along the line from point A to
> point B say at 0.2 intervals, you will find the slope actually starts to
> increase before it starts to decrease, at that the amount of
> increase/decrease is not directly relational to the interval along the
line.
>
> Mal, looking at the problem in terms of analytic geometry, you are looking
> for the intersection between two Euclidean objects in 3d-space. The first
> object describes the loci of points along a 3d line (i.e.; a vector or
ray),
> The second object is the loci of points that is a constant slope from a
> fixed 3d point in space. This is the general definition of a right
circular
> cone with the 3d-point being the vertex or fixed end of the cone. In your
> case the angle between the directrix that sweeps along the cone's surface
> and the vertical axis of the cone is the cos(3/100). What we are looking
for
> is the general equation for a line-cone intersection.
>
> The general form of the equation for a 3d vector is:
>
> AX + BY + CZ + D + E + F = 0
>
> The general form of the equation for a cone is:
>
> X^2 + Y^2 + Z^2 = (A^2/B^2) * X^2
>
> So your problem is to convert the coordinate geometry data into the
general
> form of the two equations and then solve the simultaneous equations by
> matrix or parametric means. I believe that the parametric equations would
> reduce to a quadratic form, something like:
>
> (A t^2) + (2B t) + C = 0
>
> Which would be a the quadratic equation that you would have to solve.
>
> For any quadratic equation there could be no solutions, one solution, or
two
> solutions. To graphically visualize this, we need to look at conic
sections.
> If we assume the 3d line can represent the fall vector of the plane
in-which
> it is located. The intersection of a plane and a cone is an ellipse if the
> eccentricity of the cone-plane intersection is between 0 and 1. It is a
> circle if the plane is perpendicular to the cone's axis. In fact, for this
> specific data set, Glen's approach would probably work because the
distance
> from the line to the fixed point would be constant. It becomes a parabola
> if the plane is parallel to the slope (directrix). It becomes a hyperbola
> if the plane is parallel to the cone's axis. The intersecting line in the
> plane, if the case is a circle or ellipse can be one (if the line goes
> through the foci or center) or two solutions. There would be one (or none)
> solution if the line lies in a plane perpendicular or parallel to the
cone's
> axis. So, finding universal solutions for all cases may be evolved.
>
> I apologize, I do not have the time nor readily recallable skills to
reduce
> the equations to workable parametric forms for you ( it has been ~35 years
> since analytic geometry in college). Conic sections should find
applications
> in satellite orbits, atomic structure, ray-tracing and gaming. It may be
> faster (and more reliable) for you to look-up "line-cone intersections",
or
> "conic sections" on the WEB, or ask the question in a math forum.
>
> To get your started check out:
>
> http://www.magic-software.com/Source/Intersection3D/MgcIntr3DLinCone.cpp
>
> Magic Software provides source code for gamers and visualizers. It has
free
> source code for all kinds of 3d geometrical problems. This specific page
is
> a line-cone intersection source code using 'C' routines. You can find
> Acrobat documentation for the theory at:
>
> http://www.magic-software.com/Documentation/IntersectLineCone.pdf
>
> For visual theory on conic sections check out:
>
> http://library.thinkquest.org/29033/math/cones.htm
>
> http://www.math2.org/math/algebra/conics.htm
>
> For theory of 3d coordinate geometry check out:
>
> http://www.cs.bham.ac.uk/~slb/sem307/g62.html
>
> There are also very could source books, look for the titles : "Graphics
> Gems" and "Introduction to Ray Tracing"
>
> I am sure you will find the solution quite complex. You may eventually
> realize that your initial impulse - just a binary tree iterative slope
> computations along the divided coordinates of the 3d-line may be the
> simplest solution, as long as you realize that no simple direct relation
> exists as you sample along the line. I am curious how you plan to use this
> tool in an applied civil design scenario...
>
> Good luck, and sorry I can not offer a more specific solution.
>
> sc
>
> Jeff Spannbauer wrote in message
> news:CA6851B673F9242D36BC931D13A3BEDB@in.WebX.maYIadrTaRb...
> >
> >
> > Am I calculating it right? I get a rise of .061 (which is simply delta
> Z).
> > I get a run of .99994 (which is square root of delta X squared + delta Y
> > squared). Slope is Rise/Run. So for me I get .061/.99994 = 6.1%. I'm
> > sorry but I have to ask, how did you get a slope of 3% for line CX?
> >
> > Jeff
>
>
>
Message 11 of 15
Anonymous
in reply to: Anonymous

Jeff, and Mal

OK, it is late Friday afternoon, work is done for the day. We are just
sitting around shooting the breeze. So while we were downing a few
brewskies I thought I would do something constructive and take another look
at the line-cone intersection problem (some tasks just worm their way into
my brain and do not let go).

I have attached my best attempt at a solution to the problem as a text file
(due to the formatting of various newsreaders I though it might be easier to
follow the math in this format).

My approach was to set up two simultaneous equations and solve them using
parametric equations. However, I am sure that Jeff's matrix algebra
approach also has validity. Essentially I solve for a parametric 't' value
that can be scaled along the vector to get the solution.

I coded the intersection solution equations into a simple test program, and
input Mal's data to find a solution ( I do not trust myself with adding,
subtracting, multiplying, and dividing). There actually were two solutions,
one very very close to Mal's and a second one along the vector and left of
the vector origin.

Again, I have not done any further testing, and (1) it is late Friday and I
am drinking beer and (2) it has been 35 years since I took an analytic
geometric class. I would like to think math skills are analogous to riding a
bike, but that is probably just wishful thinking. So ... check the math,
double-check the math, check the solution, check the solution on other data,
and remember I am responsible for NOTHING. If it works it works, if it
doesn't it doesn't.

sc



Jeff Spannbauer wrote in message
news:B9D958A758E991D69285C000BDE00B3C@in.WebX.maYIadrTaRb...
>
>
> The solution is the intersection of a line and a cone
Message 12 of 15
Anonymous
in reply to: Anonymous

Thanks Steve
But, where can I find your solution ?

practical application for those who were curious
Existing road running from A-B at 2%
Need to create an access to a new site point C, at 3%
Find the optimal location for the intersection.

I guess you can sometimes have two solution points !!!!
Message 13 of 15
Anonymous
in reply to: Anonymous

Mal,

I attached the solution as a .txt file to my last post. If you are using
NNTP (a dedicated newsreader) to browse this newsgroup, you should be able
to detach the txt file and open it in Notepad or a facsimile thereof.

If you are using the HTTP (web based) forum, I am not sure how you access an
attachment.

Normally I would send it to customer-files, but since you are probably the
only one interested in it, I have pasted into this message below. If it
does not format well in your reader, let me know and I will email directly
to you.

As I though about it, another application might be in gravity sewer design,
where one may want to know how to run a lateral at a minimum percent to
intersect the main line.


sc


-------------------------------------------------------------------
CONE-LINE INTERSECTION
STEPHEN CANNON
APRIL, 2002

VECTOR EQUATION
ORIGIN: E=(XE,YE,ZE); OFFSET: D=(XD,YD,ZD)
PARAMETRIC FORM: P(t) = E + tD; WHICH IS EQUAL TO THE THREE EQUATIONS:
(1) X(t) = XE + tXD
(2) Y(t) = YE + tYD
(3) Z(t) = ZE + tZD

CONE EQUATION
UNIT CONE LOCATED @ (0,0,0):
(4) X^2 + Y^2 = Z^2

UNIT CONE LOCATED @ (0,0,0) AND SCALED:
(5) X^2 + Y^2 = kZ^2

INSERTING EQUATIONS (1),(2), AND (3) INTO (5):
(6) (XE+tXD)^2 + (YE+tYD)^2 = k(ZE+tZD)^2

REDUCING (6):
(7) t^2(XD^2+YD^2-kZD^2) + t(2XEXD+2YEYD-2kZEZD) + (XE^2+YE^2-kZE^2)

THIS TAKES THE QUADRATIC FORM OF
(8) At^2 + Bt + C; WHERE

(9) A = XD^2+YD^2-kZD^2
(10) B = 2XEXD+2YEYD-2kZEZD
(11) C = XE^2+YE^2-kZE^2

THE SOLUTION TO A QUADRATIC EQUATION IS:

(12) t = (-B +- ((B^2 - 4AC)^.5))/2A

THERE WILL BE TWO SOLUTIONS FOR t; t1 AND t2. THIS CORRESPONDS TO THE CONIC
CUTTING PLANE IN WHICH THE VECTOR IS LOCATED. A COMPLEX SOLUTION WILL
INDICATE
NO SOLUTION IN 3D SPACE.

EQUATION (12) GIVES ME THE SOLUTION FOR THE INTERSECTION OF A VECTOR AND
CONE,
WHERE THE VERTEX OF THE CONE IS AT (0,0,0), AND HAS A UNIT SCALE OF 1. PRIOR
TO COMPUTING THE INTERSECTION THE CONE AND VECTOR WITH OBJECTS LOCATED
ELSEWHERE
IN 3D-SPACE, THE OBJECTS NEED TO BE TRANSFORMED:
(1) BOTH OBJECTS NEED TO BE TRANSLATED SO THAT THE VERTEX OF THE CONE
IS AT (0,0,0).
(2) THE CONE NEEDS TO BE SCALED TO REPRESENT THE REQUIRED SLOPE OF THE
PROBLEM. THE CONSTANT k IN EQUATION (5) IS COMPUTED AS:
(13) K = (100/slope in percent)^2


****************************************************************************
*****

PROBLEM:

GIVEN A POINT IN 3D-SPACE AT (1.045,2.305,1.04) FIND WHERE A 3% SLOPE
INTERSECTS
A VECTOR WHOSE ORIGIN IS (1,1,1), AND CONTAINS A POINT (1.99,1.99, 1.028)
ALONG THE
VECTOR.

SOLUTION:

I WAS CONCERNED WITH THE POTENTIAL FOR ROUNDING AND COMPUTATIONAL ERRORS, SO
I SET UP
THE FOLLOWING SIMPLE TEST PROGRAM IN HTB BASIC TO SIMPLIFY MY TASK OF
COMPUTATIONS.
THE EQUATIONS SHOULD VERY EASILY TRANSLATE INTO VBA OR LISP.

LINE-CONE INTERSECTION
STEPHEN CANNON
APRIL, 2002

10 OPTION BASE 1
20 !
30 REAL Px,Py,Pz,P1x,P1y,P1z,P2x,P2y,P2z
40 REAL Xe,Ye,Ze,Xd,Yd,Zd,K,A,B,C,T1,T2
50 !
60 !
70 Px=1.045 ! Fixed Point x
80 Py=2.305 ! Fixed Point y
90 Pz=1.04 ! Fixed Point z
100 P1x=1.0 ! Vector Origin x
110 P1y=1.0 ! Vector Origin y
120 P1z=1.0 ! Vector Origin z
130 P2x=1.99 ! Point on Vector x
140 P2y=1.99 ! Point on Vector y
150 P2z=1.028 ! Point on Vector z
160 Xe=P1x-Px ! Translate Vector Origin
170 Ye=P1y-Py ! Translate Vector Origin
180 Ze=P1z-Pz ! Translate Vector Origin
190 Xd=P2x-P1x ! Vector Delta x
200 Yd=P2y-P1y ! Vector Delta y
210 Zd=P2z-P1z ! Vector Delta z
220 K=(100/3)^2 ! Cone Scale Factor: (100/slope in percent)^2
230 !
240 !
250 A=(Xd*Xd)+(Yd*Yd)-(K*(Zd*Zd)) ! Quadratic Coefficient A
260 B=(2*Xe*Xd)+(2*Ye*Yd)-(2*K*Ze*Zd) ! Quadratic Coefficient B
270 C=(Xe*Xe)+(Ye*Ye)-(K*Ze*Ze) ! Quadratic Coefficient C
280 !
290 !
300 T1=((B*(-1)+((B*B)-(4*A*C))^.5))/(2*A) ! Solve Quadratic + option
310 ! Might need to trap for
complex no.
320 T2=((B*(-1)-((B*B)-(4*A*C))^.5))/(2*A) ! Solve Quadratic - option
330 ! Might need to trap for
complex no.
340 !
350 !
360 P3x=P1x+(T1*Xd) ! Intersection Point X
370 P3y=P1y+(T1*Yd) ! Intersection Point Y
380 P3z=P1z+(T1*Zd) ! Intersection Point Z
390 PRINT P3x;P3y;P3z ! Solution #1
400 !
410 !
420 P4x=P1x+(T2*Xd) ! Intersection Point X
430 P4y=P1y+(T2*Yd) ! Intersection Point Y
440 P4z=P1z+(T2*Zd) ! Intersection Point Z
450 PRINT P4x;P4y;P4z ! Solution #2
460 STOP
470 END

RESULTS:

P3 = (1.35284914234,1.35284914234,1.0099795717)
P4 = (0.814510934383,0.814510934383,0.994753844609)

P3 IS VERY CLOSE TO THE PUBLISHED RESULTS: (1.354,1.354,1.01). I FEEL THE
DIFFERENCES
MAY BE DUE TO ROUNDING INDUCED ERROR IN THE HAND CALCULATION.

P4 IS ALSO A VALID SOLUTION, IT EXISTS ALONG THE SAME CONSTRUCTION LINE AS
THE
INITIAL VECTOR, IT IS SIMPLY LEFT OF THE VECTOR'S ORIGIN.

TWO SOLUTIONS ARE GOING TO BE NORMAL FOR CASES WHERE THE VECTOR LIES IN A
PLANE THAT
PRODUCES A CONIC SLICE EQUIVALENT TO A CIRCLE, ELLIPSE, PARABOLA OR
HYPERBOLA. IF THE
VECTOR IS TANGENT TO THE CONIC SLICE, THEN THERE WILL BE ONLY ONE SOLUTION.

NO SOLUTIONS (COMPLEX NUMBERS) WILL BE NORMAL IF THE VECTOR LIES IN A PLANE
THE IS
PARALLEL TO THE DIRECTRIX OF THE CONE.
Message 14 of 15
Anonymous
in reply to: Anonymous

Steve - you did all this while drinking beer?!!!

--
Natan Elsberg
Pritzat Derech - 5D Digital Engineering Solutions and Consulting
E-Mail: natan@pd5d.com
LDD Apps at : http://www.pd5d.com/download/lddapps.htm

"Steve Cannon" wrote in message
news:9F587BDBEB9A63E356A69427BCD7A0D8@in.WebX.maYIadrTaRb...
> Mal,
>
> I attached the solution as a .txt file to my last post. If you are using
> NNTP (a dedicated newsreader) to browse this newsgroup, you should be able
> to detach the txt file and open it in Notepad or a facsimile thereof.
>
> If you are using the HTTP (web based) forum, I am not sure how you access
an
> attachment.
>
> Normally I would send it to customer-files, but since you are probably the
> only one interested in it, I have pasted into this message below. If it
> does not format well in your reader, let me know and I will email directly
> to you.
>
> As I though about it, another application might be in gravity sewer
design,
> where one may want to know how to run a lateral at a minimum percent to
> intersect the main line.
>
>
> sc
>
>
> -------------------------------------------------------------------
> CONE-LINE INTERSECTION
> STEPHEN CANNON
> APRIL, 2002
>
> VECTOR EQUATION
> ORIGIN: E=(XE,YE,ZE); OFFSET: D=(XD,YD,ZD)
> PARAMETRIC FORM: P(t) = E + tD; WHICH IS EQUAL TO THE THREE EQUATIONS:
> (1) X(t) = XE + tXD
> (2) Y(t) = YE + tYD
> (3) Z(t) = ZE + tZD
>
> CONE EQUATION
> UNIT CONE LOCATED @ (0,0,0):
> (4) X^2 + Y^2 = Z^2
>
> UNIT CONE LOCATED @ (0,0,0) AND SCALED:
> (5) X^2 + Y^2 = kZ^2
>
> INSERTING EQUATIONS (1),(2), AND (3) INTO (5):
> (6) (XE+tXD)^2 + (YE+tYD)^2 = k(ZE+tZD)^2
>
> REDUCING (6):
> (7) t^2(XD^2+YD^2-kZD^2) + t(2XEXD+2YEYD-2kZEZD) + (XE^2+YE^2-kZE^2)
>
> THIS TAKES THE QUADRATIC FORM OF
> (8) At^2 + Bt + C; WHERE
>
> (9) A = XD^2+YD^2-kZD^2
> (10) B = 2XEXD+2YEYD-2kZEZD
> (11) C = XE^2+YE^2-kZE^2
>
> THE SOLUTION TO A QUADRATIC EQUATION IS:
>
> (12) t = (-B +- ((B^2 - 4AC)^.5))/2A
>
> THERE WILL BE TWO SOLUTIONS FOR t; t1 AND t2. THIS CORRESPONDS TO THE
CONIC
> CUTTING PLANE IN WHICH THE VECTOR IS LOCATED. A COMPLEX SOLUTION WILL
> INDICATE
> NO SOLUTION IN 3D SPACE.
>
> EQUATION (12) GIVES ME THE SOLUTION FOR THE INTERSECTION OF A VECTOR AND
> CONE,
> WHERE THE VERTEX OF THE CONE IS AT (0,0,0), AND HAS A UNIT SCALE OF 1.
PRIOR
> TO COMPUTING THE INTERSECTION THE CONE AND VECTOR WITH OBJECTS LOCATED
> ELSEWHERE
> IN 3D-SPACE, THE OBJECTS NEED TO BE TRANSFORMED:
> (1) BOTH OBJECTS NEED TO BE TRANSLATED SO THAT THE VERTEX OF THE CONE
> IS AT (0,0,0).
> (2) THE CONE NEEDS TO BE SCALED TO REPRESENT THE REQUIRED SLOPE OF THE
> PROBLEM. THE CONSTANT k IN EQUATION (5) IS COMPUTED AS:
> (13) K = (100/slope in percent)^2
>
>
>
****************************************************************************
> *****
>
> PROBLEM:
>
> GIVEN A POINT IN 3D-SPACE AT (1.045,2.305,1.04) FIND WHERE A 3% SLOPE
> INTERSECTS
> A VECTOR WHOSE ORIGIN IS (1,1,1), AND CONTAINS A POINT (1.99,1.99, 1.028)
> ALONG THE
> VECTOR.
>
> SOLUTION:
>
> I WAS CONCERNED WITH THE POTENTIAL FOR ROUNDING AND COMPUTATIONAL ERRORS,
SO
> I SET UP
> THE FOLLOWING SIMPLE TEST PROGRAM IN HTB BASIC TO SIMPLIFY MY TASK OF
> COMPUTATIONS.
> THE EQUATIONS SHOULD VERY EASILY TRANSLATE INTO VBA OR LISP.
>
> LINE-CONE INTERSECTION
> STEPHEN CANNON
> APRIL, 2002
>
> 10 OPTION BASE 1
> 20 !
> 30 REAL Px,Py,Pz,P1x,P1y,P1z,P2x,P2y,P2z
> 40 REAL Xe,Ye,Ze,Xd,Yd,Zd,K,A,B,C,T1,T2
> 50 !
> 60 !
> 70 Px=1.045 ! Fixed Point x
> 80 Py=2.305 ! Fixed Point y
> 90 Pz=1.04 ! Fixed Point z
> 100 P1x=1.0 ! Vector Origin x
> 110 P1y=1.0 ! Vector Origin y
> 120 P1z=1.0 ! Vector Origin z
> 130 P2x=1.99 ! Point on Vector x
> 140 P2y=1.99 ! Point on Vector y
> 150 P2z=1.028 ! Point on Vector z
> 160 Xe=P1x-Px ! Translate Vector Origin
> 170 Ye=P1y-Py ! Translate Vector Origin
> 180 Ze=P1z-Pz ! Translate Vector Origin
> 190 Xd=P2x-P1x ! Vector Delta x
> 200 Yd=P2y-P1y ! Vector Delta y
> 210 Zd=P2z-P1z ! Vector Delta z
> 220 K=(100/3)^2 ! Cone Scale Factor: (100/slope in percent)^2
> 230 !
> 240 !
> 250 A=(Xd*Xd)+(Yd*Yd)-(K*(Zd*Zd)) ! Quadratic Coefficient A
> 260 B=(2*Xe*Xd)+(2*Ye*Yd)-(2*K*Ze*Zd) ! Quadratic Coefficient B
> 270 C=(Xe*Xe)+(Ye*Ye)-(K*Ze*Ze) ! Quadratic Coefficient C
> 280 !
> 290 !
> 300 T1=((B*(-1)+((B*B)-(4*A*C))^.5))/(2*A) ! Solve Quadratic + option
> 310 ! Might need to trap for
> complex no.
> 320 T2=((B*(-1)-((B*B)-(4*A*C))^.5))/(2*A) ! Solve Quadratic - option
> 330 ! Might need to trap for
> complex no.
> 340 !
> 350 !
> 360 P3x=P1x+(T1*Xd) ! Intersection Point X
> 370 P3y=P1y+(T1*Yd) ! Intersection Point Y
> 380 P3z=P1z+(T1*Zd) ! Intersection Point Z
> 390 PRINT P3x;P3y;P3z ! Solution #1
> 400 !
> 410 !
> 420 P4x=P1x+(T2*Xd) ! Intersection Point X
> 430 P4y=P1y+(T2*Yd) ! Intersection Point Y
> 440 P4z=P1z+(T2*Zd) ! Intersection Point Z
> 450 PRINT P4x;P4y;P4z ! Solution #2
> 460 STOP
> 470 END
>
> RESULTS:
>
> P3 = (1.35284914234,1.35284914234,1.0099795717)
> P4 = (0.814510934383,0.814510934383,0.994753844609)
>
> P3 IS VERY CLOSE TO THE PUBLISHED RESULTS: (1.354,1.354,1.01). I FEEL THE
> DIFFERENCES
> MAY BE DUE TO ROUNDING INDUCED ERROR IN THE HAND CALCULATION.
>
> P4 IS ALSO A VALID SOLUTION, IT EXISTS ALONG THE SAME CONSTRUCTION LINE AS
> THE
> INITIAL VECTOR, IT IS SIMPLY LEFT OF THE VECTOR'S ORIGIN.
>
> TWO SOLUTIONS ARE GOING TO BE NORMAL FOR CASES WHERE THE VECTOR LIES IN A
> PLANE THAT
> PRODUCES A CONIC SLICE EQUIVALENT TO A CIRCLE, ELLIPSE, PARABOLA OR
> HYPERBOLA. IF THE
> VECTOR IS TANGENT TO THE CONIC SLICE, THEN THERE WILL BE ONLY ONE
SOLUTION.
>
> NO SOLUTIONS (COMPLEX NUMBERS) WILL BE NORMAL IF THE VECTOR LIES IN A
PLANE
> THE IS
> PARALLEL TO THE DIRECTRIX OF THE CONE.
>
>
>
Message 15 of 15
Anonymous
in reply to: Anonymous

Thanks Steve
You are a genius and a lifesaver…………..

Yup !! and all this while drinking beer …..on a Friday, …..after work……

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report