Group Abstract Group Abstract

Message Boards Message Boards

0
|
4K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Using a table of rotation matrices to get rotated lines?

Posted 5 years ago
(* The following code builds a vector (Table?) of rotation matrices. *)
p = {0, 0, 0};
wx = {1, 0, 0}; (*About X*)
Table[rtx[i], {RotationTransform[i, wx, p], Pi/4, Pi, Pi/4}];

(* I need to use it in a loop to build a vector of objects. *)
line = {{-1, 0, 0}, {1, 0, 0 }};
b = Ball[{0, 0, 0}, 1];

For [x = 0, x < 4, x++,
   (* Rotate line about wx and produce rotatedLine ??? *)
  c = Cylinder[rotatedLine, 1/8];
  b = RegionDifference[b, c];
]

Can you explain how I use this table to create rotatedLine? I can build another table, but I need to do more.

POSTED BY: Brian OBrien
2 Replies

This gives an output, although it may not be exactly what you want:

p = {0, 0, 0};
wx = {0, 0, 1};
line = {{-1, 0, 0}, {1, 0, 0}};
b = Ball[];
Region[RegionUnion @@ Table[RegionDifference[
    TransformedRegion[Cylinder[line, 1/8],
     RotationTransform[i, wx, p]], b],
   {i, 0, Pi, Pi/4}]]
POSTED BY: Gianluca Gorni

What do you want to do?

Start with

 Line[{{0,0 }, {1,0}}]
and
Graphics[Line[{{0, 0}, {1, 0}}]]

Now with

rot = ( {
   {Cos[u], -Sin[u]},
   {Sin[u], Cos[u]}
  } )

and

Graphics[Line[{{0, 0}, rot.{1, 0}}]] /. u -> # & /@   RandomReal[{0, 2 Pi}, 5];
Show[%]

you get some rotated lines.

POSTED BY: Hans Dolhaine
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard