由于數學不太好,我的專案有問題。
目標是對 3D 檔案進行邊界校正。
在我的應用程式中,用戶在 X 軸上移動 3D 點以校正或修改物件的邊界。
我想在相同的方向上移動最近的邊界點但逐漸減少。我的意思是沒有一點應該比主要觀點移動得更多。最近的點移動最多,最遠的點應該移動較少。
在影像上,紅點代表點的初始狀態。并且用戶在 x 方向拉動 P0。其他點緊隨其后。點的最后狀態由紫色圓點表示。
這是我嘗試過的。
//On point moved event
//Get nearest boundary Points (Uses Geometry3D to get boundary points).
(var clothDMesh, _) = Utilities3D.BuildDMesh(baseMesh);
CreateClothModel(clothDMesh);
var boundryVertices = nodes.Where(ro => ro.Value.isBorder).Select(ro => ro.Value.vertex).ToList();
var refPoint = CustomPoint.FromPoint3D(movedPoint);
//Gets the delta X.
var deltaX = p.X - initialX;
//Gets nearest country points, so 15 points above and 15 points below to move only a given number of points (I know maybe this should be calculated according to delta).
var nearestPoints = refPoint.GetNearesPoints(boundryVertices, 30);
foreach (var item in nearestPoints)
{
//This is only one of what I tried as a function. None of them worked correctly.
item.X = deltaX - (deltaX * 1/ Math.Pow(item.Distance, 2));
}
任何幫助將不勝感激。
提前致謝。

uj5u.com熱心網友回復:
這是數學部分:我稱“a”為您的“deltaX”。我們還需要第二個引數:“b”,紅點的最大高度。我假設它是對稱的,“-b”將是紅點的最小高度。
因此,如果您在點的坐標 Y 中查找值 X,水平移動:
X = a - a * Y * Y / (b * b);
您可以驗證對于 Y = 0,您將獲得 X = a,對于 Y = b(或 -b),您將獲得 X = 0。您有拋物線(X 是 Y^2 的函式)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/399883.html
上一篇:大小的固定位數與大小寫/單位無關
