The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

Challenge(?): Intersection curve between two cylinders in a specific position
Message #1 Posted by Pier Aiello on 16 Sept 2013, 5:58 a.m.

As the figure above shows, we have two identical cylinders, one blue and one black. We want to put the two in the following way: the green line on the black cylinder must do an angle of 45 degrees with the green line on the blue cylinder, and those two lines are touching in one point that is one ending point of the second line. The axes (1) (vertical for the black cylinder, and at 45 degrees for the blue one) are on the same plane, that is, the two lines forming the axes are not skewed, but they are intersected somewhere.
Given that, we have that the blue cylinder is intersecting the black one, and we want to know which is the curve that this intersection produces on the blue cylinder.

How do you solve this with you calculator (2) (? (eventually, are you able to plot the solution and/or the 3d scenario with the curve highlighted?)
Note: (i still have not solved it, i think that it could be a nice challenge)

Some restrictions to avoid tricks:
- The cylinders have an r>0 (in real world can be a tube such as these)

(1) For axis I mean: the line that is normal to the base of the cylinder and that cross the center of that base. (2) Pick some numbers, like: radius=100 and height=10'000.

Edited: 16 Sept 2013, 6:07 a.m.

      
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #2 Posted by Jean-Michel on 16 Sept 2013, 1:17 p.m.,
in response to message #1 by Pier Aiello

Hello Pier

This is an interesting challenge.
I guess you mean we have to draw the intersection line between the two cylinders, i.e. the curve that is common to both outer surfaces of the cylinders, in plane projection ?
I mean, when the drawing is viewed in a way so that both cylinders appears like rectangles, and not in any projection ? Am I right?

            
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #3 Posted by Pier Aiello on 16 Sept 2013, 5:42 p.m.,
in response to message #2 by Jean-Michel

yes, you can do a plane projection (specifing the plane). Or: Is the curve given by the intersection on a plane (1)? (i don't know actually, even if i guess not)

(1) That is: are all the intersection points on the same plane ?

Edited: 16 Sept 2013, 5:42 p.m.

      
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #4 Posted by peacecalc on 16 Sept 2013, 2:22 p.m.,
in response to message #1 by Pier Aiello

Hello Pier,

that is a funny story. The hobby card modeling has to solve such questions with a lot of intersecting shapes. I wrote for the hp 50g such a program for finding the point whichs belonges to the shapes both. Some of the card modeling collegues thinks that I'm a crazy guy doing this task with on a calculator and not with an 3-D program like rhino or blender.

The main idea of my program is that one surface is build with plane triangles. The other surface is builded with a bunch of lines.

The lines are used to be straight lines which are intersected with the triangles of the other shape. The hp 50g can handle in excellent way vectors and in connection with the dot-product it is easy to find out where the lines and the plane triangles have common points or not.

The program is written in RPL (of course) and a bit long. The documentation is a bit spartan. So I don't know if it make sence to show you here the program text.

Greetings peacecalc

            
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #5 Posted by Pier Aiello on 16 Sept 2013, 5:45 p.m.,
in response to message #4 by peacecalc

Why not? Is just another contribution! Don't feel ashamed.

I'm ashamed here, there are really good people both in using calculators and math! But, imo, it's better to contribute (as best as you can) anyway.

                  
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #6 Posted by peacecalc on 17 Sept 2013, 3:09 p.m.,
in response to message #5 by Pier Aiello

Okay Pier,

%%HP: T(3)A(R)F(,);
\<< \-> SPANT1xUMR SPANT2xUMR SPANT1xHULL SPANT2xHULL
  \<< SPANT2xHULL BODY DUP SIZE SWAP SPANT1xHULL SPANT2xHULL - BODY 
	SPANT2xHULL TAIL SPANT2xHULL BODY - 
	SPANT1xHULL BODY SPANT1xHULL TAIL 
	SPANT1xHULL BODY - 
	SPANT2xHULL TAIL SPANT1xHULL BODY - 
	SPANT1xUMR DUP SIZE SWAP SPANT2xUMR SPANT1xUMR - 
	\-> 	HULLxNUM TRAEGxHULL2 RICHT1xHULL2 RICHT2xHULL2 
		TRAEGxHULL1 RICHT1xHULL1 RICHT2xHULL1 
		UMxNUM TRAEGxUM RICHTxUM
    \<< RICHT1xHULL2 RICHT2xHULL2 CROSS RICHT1xHULL1 RICHT2xHULL1 CROSS { } { } 
		\-> NORMxHULL2 NORMxHULL1 SCHNITTxHULL2 SCHNITTxHULL1
      \<< 1 HULLxNUM
        FOR j 1 UMxNUM
          FOR i RICHTxUM i GET NORMxHULL2 j GET DUP ROT DOT DUP
            IF 0, \=/
            THEN SWAP TRAEGxHULL2 j GET TRAEGxUM i GET - DOT SWAP / DUPDUP
              IF 0, \>= SWAP 1, \<= AND
              	THEN    TRAEGxUM i GET 
			RICHTxUM i GET ROT * + DUP 
			TRAEGxHULL2 j GET 
			RICHT1xHULL2 j GET 
			RICHT2xHULL2 j GET 
			NORMxHULL2 j GET 
			\-> SCHNITTxPKT TRAEGxHULL RICHTxHULLx1 RICHTxHULLx2 NORMxHULL
                \<< SCHNITTxPKT TRAEGxHULL - DUP RICHTxHULLx2 CROSS 
					SWAP RICHTxHULLx1 CROSS NORMxHULL DOT 
					SWAP NORMxHULL DOT 
					NORMxHULL NORMxHULL DOT 
					DUP ROT SWAP / UNROT NEG /
                \>> \-> KOEFFxRICHTx1 KOEFFxRICHTx2
                \<< KOEFFxRICHTx1 DUP
                  IF 0, \>= SWAP 1, \<= AND
                  THEN KOEFFxRICHTx2 DUP
                    IF 0, \>= SWAP 1, KOEFFxRICHTx1 - \<= AND
                    THEN j 2 \->LIST SCHNITTxHULL2 SWAP + 'SCHNITTxHULL2' STO
                    ELSE DROP
                    END
                  ELSE DROP
                  END
                \>>
              ELSE DROP
              END
            ELSE DROP DROP
            END
          NEXT
        NEXT 1 HULLxNUM
        FOR j 1 UMxNUM
          FOR i RICHTxUM i GET NORMxHULL1 j GET DUP ROT DOT DUP
            IF 0, \=/
            THEN SWAP TRAEGxHULL1 j GET TRAEGxUM i GET - DOT SWAP / DUPDUP
              IF 0, \>= SWAP 1, \<= AND
              THEN 	TRAEGxUM i GET 
			RICHTxUM i GET ROT * + DUP 
			TRAEGxHULL1 j GET 
			RICHT1xHULL1 j GET 
			RICHT2xHULL1 j GET 
			NORMxHULL1 j GET 
			\-> SCHNITTxPKT TRAEGxHULL RICHTxHULLx1 RICHTxHULLx2 NORMxHULL
                \<< SCHNITTxPKT TRAEGxHULL - DUP RICHTxHULLx2 CROSS 
					SWAP RICHTxHULLx1 CROSS 
					NORMxHULL DOT 
					SWAP NORMxHULL DOT 
					NORMxHULL NORMxHULL DOT 
					DUP ROT SWAP / UNROT NEG /
                \>> \-> KOEFFxRICHTx1 KOEFFxRICHTx2
                \<< KOEFFxRICHTx1 DUP
                  IF 0, \>= SWAP 1, \<= AND
                  THEN KOEFFxRICHTx2 DUP
                    IF 0, \>= SWAP 1, KOEFFxRICHTx1 - \<= AND
                    THEN j 2 \->LIST SCHNITTxHULL1 SWAP + 'SCHNITTxHULL1' STO
                    ELSE DROP
                    END
                  ELSE DROP
                  END
                \>>
              ELSE DROP
              END
            ELSE DROP DROP
            END
          NEXT
        NEXT SCHNITTxHULL1 DUP SIZE 1 - SCHNITTxHULL1 SWAP GET SWAP 1 GET
        IF ==
        THEN SCHNITTxHULL1 BODY BODY 'SCHNITTxHULL1' STO
        END SCHNITTxHULL2 'U1' STO SCHNITTxHULL1 'U2' STO
      \>>
    \>>
  \>>
\>>

So you get what you want (YGWYW ;-))

The input are four lists with 3-D vectors, the first two list discribe f. example the blue cylinder (there are only the coordinates needed in form of the bottom and top circle (the frames or formers of the cylinder)), the next two lists describe f. example the black cylinder (in the same form).

The user decides how fine (how many intersections points should be find), by the size of the lists. The lists of the different shapes can have a different size, but the pair itself must have the same size.

The user gets after some time two lists back "U1" and "U2", these two lists contain the intersections points in 3-D vectors.

It is not a analytical solution, it's numerical, but it works for all different shapes, which could be generated by two frames (two 3-D polygons).

It is a very clumsy piece of program, but you have to imagine, the calculator has to find out, if there are common points and where they are.

Greetings peacecalc

                        
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #7 Posted by Pier Aiello on 17 Sept 2013, 4:44 p.m.,
in response to message #6 by peacecalc

Whoa, it's huge! Thanks for your contribution.

      
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #8 Posted by Thomas Klemm on 16 Sept 2013, 5:33 p.m.,
in response to message #1 by Pier Aiello

Black cylinder

Assume r = 1:
x2 + y2 = 1

Blue cylinder

  • P ... point on cylinder
  • e ... direction of axis

Assume r = 1:

    | x |      | 0 |
P = | y |, e = | 1 |
    | z |      | 1 |

| P x e | = 1 * | e |

| x | | 0 | | y - z | | y | x | 1 | = | - x | | z | | 1 | | x |

2x2 + (y - z)2 = 2 (y - z)2 = 2 - 2x2 = 2y2 y - z = +/- sqrt(2)y z = (1 +/- sqrt(2))y

So we end up with the following possible parametrisation:

x = cos(t)
y = sin(t)
z = (1 + sqrt(2))sin(t)

We could have expected this. For symmetric reasons the intersection curve must be in a plane. Cut that with a cylinder and you get an ellipsis.

Furthermore tan(67.5) = 1 + sqrt(2) and tan(-22.5) = 1 - sqrt(2).

Quote:
Where in this do you need a calculator?

Cheers
Thomas

            
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #9 Posted by Pier Aiello on 16 Sept 2013, 5:48 p.m.,
in response to message #8 by Thomas Klemm

Nice! Quick and elegant! (moreover i'll analyze it more asap)

About "where in this do you need a calculator?", it's not mandatory but if someone want to use it, why not?

                  
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #10 Posted by Thomas Klemm on 16 Sept 2013, 6:01 p.m.,
in response to message #9 by Pier Aiello

Oops, just noted that e should rather be (0, 1, -1). But it doesn't change much: just switch the sign of z.

Cheers
Thomas

      
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #11 Posted by Csaba Tizedes (Hungary) on 17 Sept 2013, 7:09 a.m.,
in response to message #1 by Pier Aiello

Maybe it is required some thinking to calculate intersection curves, but the manufacturing is VERY simple, because the equal diameter pipes intersection curve is always two line in side view. This is a simple straight cut on pipes.

            
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #12 Posted by Pier Aiello on 17 Sept 2013, 7:46 a.m.,
in response to message #11 by Csaba Tizedes (Hungary)

Why do you get a sort of triangle on the blue cylinder?

Remember that one "side" of the blue cylinder is untouched (the green one in the picture), while the other can be "cut" by the intersection line.

                  
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #13 Posted by Csaba Tizedes (Hungary) on 17 Sept 2013, 8:53 a.m.,
in response to message #12 by Pier Aiello

Those triangles are not visible, only I don't erase them. I do not understand exactly the "one side is untouched"?!?

                        
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #14 Posted by Pier Aiello on 17 Sept 2013, 10:22 a.m.,
in response to message #13 by Csaba Tizedes (Hungary)

A cylinder has no sides :P, what I meant is the green (dotted) line/side of the blue cylinder in the first picture.

      
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #15 Posted by Kimberly Thompson on 17 Sept 2013, 1:41 p.m.,
in response to message #1 by Pier Aiello

Pier

This is not an answer to your challenge, but rather an edification resource;
Link to Unwrapping Curves from Cylinders and Cones
the Pdf is highly enlightening.
BEST!

SlideRule

            
Re: Challenge(?): Intersection curve between two cylinders in a specific position
Message #16 Posted by Pier Aiello on 17 Sept 2013, 5:58 p.m.,
in response to message #15 by Kimberly Thompson

Thanks a lot :)


[ Return to Index | Top of Index ]

Go back to the main exhibit hall