I want to get several points (preferably by a single function that can be ran within a for loop if needed) on the surface of an ellipsoid (scaled part with a sphere special mesh). I have the center since it’s just a part still, and the sizes of the axis as well. I realize that the solution here is going to be really math-heavy and I’m ready for it.
Currently my attempt at it is very rudimentary and guess-y since I have no idea what I’m doing. I think I can create a smaller sphere within it that uses the smallest axis, then get some Gaussian distributions with the mean being the original axis lengths and the smallest, then using a formula I saw on StackExchange (I cannot locate the link now, sorry), and then multiplying my new numbers with the ratios of the original axis and the smallest one. I’m probably going in the complete wrong direction so I don’t really know.
I am using @NoahWillCode 's stats repository for my Gaussian distributions.
(Don’t mind the “big” variable, it was used in an earlier attempt)
Current Code
local stats = require(game.ServerStorage.statistics)
function getpoint()
local x,y,z = script.Parent.Size.X,script.Parent.Size.Y,script.Parent.Size.Z
local smol = nil
if x < y and x < z then
smol = x
elseif y < x and y < z then
smol = y
else
smol = z
end
local big = nil
if x > y and x > z then
big = x
elseif y > x and y > z then
big = y
else
big = z
end
local difX = x/smol
local difY = y/smol
local difZ = z/smol
local p1 = stats.distributions.normal(x,smol)
local p2 = stats.distributions.normal(y,smol)
local p3 = stats.distributions.normal(z,smol)
local ize = 1/math.sqrt(p1^2+p2^2+p3^2)
local n1,n2,n3 = (p1*ize)*smol,(p2*ize)*smol,(p3*ize)*smol
return Vector3.new(n1*difX, n2*difY, n3*difZ) + script.Parent.Position
end
Any help would be appreciated!