void AABB::TransformAsAABB(const Quat &transform) { vec newCenter = transform.Transform(CenterPoint()); vec newDir = Abs((transform.Transform(Size()) * 0.5f)); minPoint = newCenter - newDir; maxPoint = newCenter + newDir; }
void AABB::TransformAsAABB(const Quat &transform) { float3 newCenter = transform.Transform(CenterPoint()); float3 newDir = Abs((transform.Transform(Size()) / 2.f)); minPoint = newCenter - newDir; maxPoint = newCenter + newDir; }
//--------------------------------------------------------------------------- void __fastcall TForm2::lblHomePageMouseEnter(TObject *Sender) { BalloonHint1->Title = "クリックするとブラウザが起動します。"; BalloonHint1->Description = ""; BalloonHint1->ShowHint(lblHomePage->ClientToScreen(CenterPoint(lblHomePage->ClientRect))); }
//--------------------------------------------------------------------------- void __fastcall TForm2::lblLisenceJMouseEnter(TObject *Sender) { BalloonHint1->Title = "http://ossipedia.ipa.go.jp/legalinfo/gpl-3.0J.html"; BalloonHint1->Description = "クリックするとブラウザが起動します。"; BalloonHint1->ShowHint(lblLisenceJ->ClientToScreen(CenterPoint(lblLisenceJ->ClientRect))); }
//--------------------------------------------------------------------------- void __fastcall TForm2::lblLisenceMouseEnter(TObject *Sender) { BalloonHint1->Title = "https://www.gnu.org/licenses/gpl-3.0.html"; BalloonHint1->Description = "クリックするとブラウザが起動します。"; BalloonHint1->ShowHint(lblLisence->ClientToScreen(CenterPoint(lblLisence->ClientRect))); }
void main() { int i, j, cp; MTGraph G; IniMGraph_directed(&G); VertexData v[]={'a', 'b', 'c', 'd', 'e','f'};//顶点集 EdgeData e[NumVertices][NumVertices]={ {0,3,MaxValue,4,MaxValue,5}, {MaxValue,0,1, MaxValue, MaxValue,1}, {MaxValue, MaxValue,0,2,MaxValue,MaxValue}, {MaxValue,3,MaxValue,0,MaxValue,MaxValue}, {MaxValue, MaxValue, MaxValue,3,0,2}, {MaxValue,MaxValue,MaxValue,2,MaxValue,0} };//边集,邻接矩阵 CreateMGraph_directed(&G, v, e, 6); EdgeData A[NumVertices][NumVertices]={0}; int A1[NumVertices][NumVertices]={0}; int P[NumVertices][NumVertices]; Floyd(A, G, P, G.n); cout<<"每一对顶点之间的最短路径:"<<endl; for(i=0; i<G.n; i++) { for(int j=0; j<G.n; j++) cout<<A[i][j]<<'\t'; cout<<endl; } cout<<"相通节点之间的路径长以及中间节点: "<<endl; for(i=0; i<G.n; i++) for(j=0; j<G.n; j++) { if(A[i][j]<MaxValue) { cout<<G.vexlist[i]<<"->"<<G.vexlist[j]<<", 最短路径长度: "<<A[i][j]<<", 中间结点"<<':'<<endl;; Path(P, i, j); } } //求传递闭包 Warshall(A1, G, G.n); cout<<"\n传递闭包为:"<<endl; for(i=0; i<G.n; i++) { for(int j=0; j<G.n; j++) cout<<A1[i][j]<<'\t'; cout<<endl; } //求中心节点 CenterPoint(A, G.n, cp); cout<<"\n\n中心点为: "<<G.vexlist[cp+1]<<endl; }
void AABB::ProjectToAxis(const float3 &axis, float &dMin, float &dMax) const { float3 c = CenterPoint(); float3 e = HalfDiagonal(); // Compute the projection interval radius of the AABB onto L(t) = aabb.center + t * plane.normal; float r = e[0]*Abs(axis[0]) + e[1]*Abs(axis[1]) + e[2]*Abs(axis[2]); // Compute the distance of the box center from plane. float s = Dot(axis, c); dMin = s - r; dMax = s + r; if (dMin > dMax) Swap(dMin, dMax); }
Sphere AABB::MaximalContainedSphere() const { vec halfSize = HalfSize(); return Sphere(CenterPoint(), Min(halfSize.x, halfSize.y, halfSize.z)); }
Sphere AABB::MinimalEnclosingSphere() const { return Sphere(CenterPoint(), Size().Length() * 0.5f); }
Sphere AABB::MaximalContainedSphere() const { float3 size = Size(); return Sphere(CenterPoint(), Min(Min(size.x, size.y), size.z)); }