From: S. B. Gray on
I have displays like this:

th = .01;
cp1 = { 1, -1, 2};
cp2 = { 2, 0, 1};
cp3 = {-1, 3, 2};
Graphics3D[{Opacity[.4],
Yellow, Cylinder[{cp1, cp1 + {th, -th, th}}, 12],
Green, Cylinder[{cp2, cp2 - {th, th, -th}}, 15],
Red, Cylinder[{cp3, cp3 + {-th, -th, -th}}, 12]},
Boxed -> False]

but the cylinders are stand-ins for what I really want, which is circles
in 3D. (I would like a 3D circle primitive with circles defined by three
points, rather than the way cylinders are specified.)

The smallest number of circles in the actual application is 20, so it is
almost impossible to see how they interact, no matter what Opacity is
set to. It would be much better if I could make the edges thicker and
opaque (with EdgeForm), and have the cylinder ends or sides transparent.
That way the edges (rings or circles) would occlude each other so it
would be clear what is in front of what. So far as I know, the edges
cannot be contolled separately. If you set "th" to a higher value, you
get a double ring which is really the cylinder side, which also cannot
be given its own Opacity.

I've tried parametric plot to display thick torii, but it's glacially
slow. Any tips will be appreciated.

Steve Gray

From: Albert Retey on
Am 08.07.2010 09:13, schrieb S. B. Gray:
> I have displays like this:
>
> th = .01;
> cp1 = { 1, -1, 2};
> cp2 = { 2, 0, 1};
> cp3 = {-1, 3, 2};
> Graphics3D[{Opacity[.4],
> Yellow, Cylinder[{cp1, cp1 + {th, -th, th}}, 12],
> Green, Cylinder[{cp2, cp2 - {th, th, -th}}, 15],
> Red, Cylinder[{cp3, cp3 + {-th, -th, -th}}, 12]},
> Boxed -> False]
>
> but the cylinders are stand-ins for what I really want, which is circles
> in 3D. (I would like a 3D circle primitive with circles defined by three
> points, rather than the way cylinders are specified.)
>
> The smallest number of circles in the actual application is 20, so it is
> almost impossible to see how they interact, no matter what Opacity is
> set to. It would be much better if I could make the edges thicker and
> opaque (with EdgeForm), and have the cylinder ends or sides transparent.
> That way the edges (rings or circles) would occlude each other so it
> would be clear what is in front of what. So far as I know, the edges
> cannot be contolled separately. If you set "th" to a higher value, you
> get a double ring which is really the cylinder side, which also cannot
> be given its own Opacity.

I think I am missing your point, the following does what you described
and seems to work, is it something else that you want?

th = .01;
cp1 = {1, -1, 2};
cp2 = {2, 0, 1};
cp3 = {-1, 3, 2};
Graphics3D[{
Opacity[0],
EdgeForm[Directive[Opacity[1], Thickness[th], Yellow]],
Cylinder[{cp1, cp1 + {th, -th, th}}, 12],
EdgeForm[Directive[Opacity[1], Thickness[th], Green]],
Cylinder[{cp2, cp2 - {th, th, -th}}, 15],
EdgeForm[Directive[Opacity[1], Thickness[th], Red]],
Cylinder[{cp3, cp3 + {-th, -th, -th}}, 12]
}, Boxed -> False]

I have included Opacity in EdgeForm to show that this works, but of
course with a value of 1 you could just as well omit it...

hth,

albert

From: David Park on
Well, you always present interesting graphics problems. Presentations does
have Circle3D and Disk3D, (Using a flattened Cylinder isn't that bad, but
isn't it easier to think in terms of a 2D object in 3D space?). So using
Circle3D and the Presentations, PlaneGeometry, triangleCircumcenter routine
we can easily construct the graphic.

Needs["Presentations`Master`"]

First, here is your example:

cp1 = {1, -1, 2};
cp2 = {2, 0, 1};
cp3 = {-1, 3, 2};
Draw3DItems[
{AbsoluteThickness[4],
Yellow, Circle3D[cp1, {1, -1, 1}, 12],
Green, Circle3D[cp2, -{1, 1, -1}, 15],
Red, Circle3D[cp3, -{1, 1, 1}, 12]},
NiceRotation,
Boxed -> False
]

But you wanted to define the circles by three points. Here is a routine that
calculates the 3D center from the three points.

sphereCenter::usage =
"sphereCenter[{p1, p2, p3}] calculates the center of a sphere that \
passes through the three points p1, p2, p3 and lies in the plane of \
the three points.";
SyntaxInformation[sphereCenter] = {"ArgumentsPattern" -> {{_, _, _}}};
sphereCenter[{p1_, p2_, p3_}] :=
Module[{normal, q1, q2, q3, center},
(* Translate p1 to the origin = q1 *)
{q1, q2, q3} = TranslationTransform[-p1]@{p1, p2, p3};
(* Calculate a normal vector *)
normal = q2\[Cross]q3;
(* Rotate the normal vector to the z vector *)
{q1, q2, q3} =
RotationTransform[{normal, {0, 0, 1}}]@{q1, q2, q3} // Chop;
(* Find the center in 2D by dropping z components *)
center = First(a)triangleCircumcenter[Drop[#, -1] & /@ {q1, q2, q3}];
(* Pad and inverse rotate *)
center =
RotationTransform[{{0, 0, 1}, normal}]@PadRight[center, 3] // Chop;
(* Translate the origin back to p1*)
center = TranslationTransform[p1]@center]

The following generates a set of 10 random sets of circle points.

circlePoints = RandomReal[{0, 10}, {10, 3, 3}];

The following draws all the circles using colors picked from an indexed
color set.

Draw3DItems[
{AbsoluteThickness[4],
Table[
Module[{p1, p2, p3, center, normal, radius},
{p1, p2, p3} = circlePoints[[i]];
center = sphereCenter[{p1, p2, p3}];
normal = Cross[p1 - p2, p1 - p3];
radius = Norm[p1 - center];
{ColorData[31, i], Circle3D[center, normal, radius]}
], {i, 1, 10}]},
NiceRotation,
Boxed -> False
]

The following adds the defining points to the circles.

Draw3DItems[
{AbsoluteThickness[4],
Table[
Module[{p1, p2, p3, center, normal, radius},
{p1, p2, p3} = circlePoints[[i]];
center = sphereCenter[{p1, p2, p3}];
normal = Cross[p1 - p2, p1 - p3];
radius = Norm[p1 - center];
{ColorData[31, i],
Circle3D[center, normal, radius],
AbsolutePointSize[5], Opacity[.999, Black],
Point[{p1, p2, p3}]}
], {i, 1, 10}]},
NiceRotation,
Boxed -> False
]

The following adds a low opacity disk to each circle.

Draw3DItems[
{AbsoluteThickness[4],
Table[
Module[{p1, p2, p3, center, normal, radius},
{p1, p2, p3} = circlePoints[[i]];
center = sphereCenter[{p1, p2, p3}];
normal = Cross[p1 - p2, p1 - p3];
radius = Norm[p1 - center];
{ColorData[31, i], Opacity[.999], Circle3D[center, normal, radius],
Opacity[.1],
Disk3D[center, normal, radius, Mesh -> None, MaxRecursion -> 1,
PlotPoints -> 10],
AbsolutePointSize[5], Opacity[.999, Black],
Point[{p1, p2, p3}]}
], {i, 1, 10}]},
NiceRotation,
Boxed -> False
]


David Park
djmpark(a)comcast.net
http://home.comcast.net/~djmpark/



From: S. B. Gray [mailto:stevebg(a)ROADRUNNER.COM]

I have displays like this:

th = .01;
cp1 = { 1, -1, 2};
cp2 = { 2, 0, 1};
cp3 = {-1, 3, 2};
Graphics3D[{Opacity[.4],
Yellow, Cylinder[{cp1, cp1 + {th, -th, th}}, 12],
Green, Cylinder[{cp2, cp2 - {th, th, -th}}, 15],
Red, Cylinder[{cp3, cp3 + {-th, -th, -th}}, 12]},
Boxed -> False]

but the cylinders are stand-ins for what I really want, which is circles
in 3D. (I would like a 3D circle primitive with circles defined by three
points, rather than the way cylinders are specified.)

The smallest number of circles in the actual application is 20, so it is
almost impossible to see how they interact, no matter what Opacity is
set to. It would be much better if I could make the edges thicker and
opaque (with EdgeForm), and have the cylinder ends or sides transparent.
That way the edges (rings or circles) would occlude each other so it
would be clear what is in front of what. So far as I know, the edges
cannot be contolled separately. If you set "th" to a higher value, you
get a double ring which is really the cylinder side, which also cannot
be given its own Opacity.

I've tried parametric plot to display thick torii, but it's glacially
slow. Any tips will be appreciated.

Steve Gray



From: S. B. Gray on
On 7/8/2010 3:50 AM, Albert Retey wrote:

> th = .01;
> cp1 = {1, -1, 2};
> cp2 = {2, 0, 1};
> cp3 = {-1, 3, 2};
> Graphics3D[{
> Opacity[0],
> EdgeForm[Directive[Opacity[1], Thickness[th], Yellow]],
> Cylinder[{cp1, cp1 + {th, -th, th}}, 12],
> EdgeForm[Directive[Opacity[1], Thickness[th], Green]],
> Cylinder[{cp2, cp2 - {th, th, -th}}, 15],
> EdgeForm[Directive[Opacity[1], Thickness[th], Red]],
> Cylinder[{cp3, cp3 + {-th, -th, -th}}, 12]
> }, Boxed -> False]

Albert, What you sent does indeed look like what I want. I will examine
it more later, but thank you very much!
Yours was the only reply that really helped.

Steve Gray