Centroid of ParametricPlot3D

Helo All

I have some Question.

i just have this shape with ParametricPlot3D.

how can I calculate this shape with RegionCentroid Function? here my code

r = 10;
scc = 1;
zx = 5;
ppp = {x[1], y[1], z[1]} = {r*Sin[u], scc*v, r*Cos[u]};
sp = 116*Cot[\[Pi]/180*72];
pcg1 = {};
For[i = 1, i <= zx, i++,
\[CurlyPhi] = (\[Pi]/2)/zx*i;
{xi, yi, zi, dummy} = ( {
{Cos[\[CurlyPhi]], -Sin[\[CurlyPhi]], 0, 0},
{Sin[\[CurlyPhi]], Cos[\[CurlyPhi]], 0, 0},
{0, 0, 1, sp*\[CurlyPhi]},
{0, 0, 0, 1}
} ).( {
{1, 0, 0, 0},
{0, 1, 0, 6 r},
{0, 0, 1, 0},
{0, 0, 0, 1}
} ).Insert[ppp, 1, 4];
AppendTo[pcg1, {xi, yi, zi}]
]
ParametricPlot3D[pcg1, {u, 0, 2 \[Pi]}, {v, 0, 10},
AxesLabel -> {x, y, z}, PlotRange -> Full]


Thank you

Method-1

Using the code by author.

RegionCentroid@*DiscretizeGraphics@
ParametricPlot3D[pcg1, {u, 0, 2 π}, {v, 0, 10},
AxesLabel -> {x, y, z}, PlotRange -> Full]


{-47.5395, 34.5392, 35.5237}

Method-2

We rewrite the code,replace For by Table etc.

Clear["Global*"];
r = 10;
scc = 1;
zx = 5;
ppp = {r*Sin[u], scc*v, r*Cos[u]};
sp = 116*Cot[π/180*72];
pcg1 = Table[Block[{φ = (π/2)/zx*i},
({{Cos[φ], -Sin[φ], 0, 0}, {Sin[φ],
Cos[φ], 0, 0}, {0, 0, 1, sp*φ}, {0, 0, 0,
1}}) . ({{1, 0, 0, 0}, {0, 1, 0, 6 r}, {0, 0, 1, 0}, {0, 0, 0,
1}}) . PadRight[ppp, 4, 1]], {i, 1, zx}];
pcg1 = pcg1[[;; , 1 ;; 3]];
ParametricPlot3D[pcg1, {u, 0, 2 π}, {v, 0, 10},
AxesLabel -> {x, y, z}, PlotRange -> All] //
DiscretizeGraphics // RegionCentroid


{-47.5395, 34.5392, 35.5237}

Method-3

Rewrite all the code，replace the matrix product by geometric transformation and using TransformedRegion.

Clear["Global*"];
r = 10;
scc = 1;
zx = 5;
ppp = {r*Sin[u], scc*v, r*Cos[u]};
sp = 116*Cot[π/180*72];
reg = ParametricRegion[ppp, {{u, 0, 2 π}, {v, 0, 10}}];
Table[Block[{φ = (π/2)/zx*i},
TransformedRegion[reg,
RotationTransform[φ, {0, 0, 1}]@*
TranslationTransform[sp*φ {0, 0, 1}]@*
TranslationTransform[6 r {0, 1, 0}]]], {i, 1, zx}] //
Map@DiscretizeRegion // RegionUnion
% // RegionCentroid


{-47.538, 34.543, 35.5203}

• Thank you, I will try this method!
– 葉柏樂
Feb 22, 2023 at 4:02
• I start to use your first method, but its not work, am I wrong? here is my picture of code drive.google.com/file/d/1clmvYILo5VgfcsSn7AAFWw4m-MByrYZC/…
– 葉柏樂
Feb 22, 2023 at 5:51
• @葉柏樂AbdullahSyafiq We need to use new version 11,12 or 13 Feb 22, 2023 at 5:59
• i got it, because i still use version 10. thank you
– 葉柏樂
Feb 22, 2023 at 6:15
\$Version

(* "13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)" *)

ClearAll["Global*"]

r = 10;
scc = 1;
zx = 5;
ppp = {x[1], y[1], z[1]} = {r*Sin[u], scc*v, r*Cos[u]};
sp = 116*Cot[π/180*72];
pcg1 = {};
For[i = 1, i <= zx, i++, φ = (π/2)/zx*i;
{xi, yi, zi,
dummy} = ({{Cos[φ], -Sin[φ], 0, 0}, {Sin[φ],
Cos[φ], 0, 0}, {0, 0, 1, sp*φ}, {0, 0, 0,
1}}) . ({{1, 0, 0, 0}, {0, 1, 0, 6 r}, {0, 0, 1, 0}, {0, 0, 0, 1}}) .
Insert[ppp, 1, 4];
AppendTo[pcg1, {xi, yi, zi}]]

pcg1 = pcg1 // Simplify;


The individual regions are

paraRgns = ParametricRegion[#, {{u, 0, 2 π}, {v, 0, 10}}] & /@ pcg1;


All of the regions are the same size

SameQ @@ (RegionMeasure /@ paraRgns)

(* True *)


Average the individual centroids

centroid = Mean[RegionCentroid /@ paraRgns] //
FullSimplify

(* {-(13/2) (2 + Sqrt[5] + Sqrt[5 + 2 Sqrt[5]]),
13/2 (Sqrt[5] + Sqrt[5 + 2 Sqrt[5]]), 174/5 Sqrt[1 - 2/Sqrt[5]] π} *)

centroid // N

(* {-47.5394, 34.5394, 35.5226} *)

Show[
ParametricPlot3D[pcg1, {u, 0, 2 π}, {v, 0, 10},
AxesLabel -> {x, y, z}, PlotRange -> Full],
Graphics3D[{Red, AbsolutePointSize[8], Point[centroid]}]]


• (+1) Good, Mean` work for the geometric center. Feb 20, 2023 at 15:36
• thank you! i will try this
– 葉柏樂
Feb 22, 2023 at 5:38