本文整理汇总了C#中Axiom.Math.AxisAlignedBox类的典型用法代码示例。如果您正苦于以下问题:C# AxisAlignedBox类的具体用法?C# AxisAlignedBox怎么用?C# AxisAlignedBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AxisAlignedBox类属于Axiom.Math命名空间,在下文中一共展示了AxisAlignedBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PCZCamera
public PCZCamera( string name, SceneManager sceneManager )
: base( name, sceneManager )
{
this.box = new AxisAlignedBox( new Vector3( -0.1f, -0.1f, -0.1f ), new Vector3( 0.1f, 0.1f, 0.1f ) );
this.extraCullingFrustum = new PCZFrustum();
this.extraCullingFrustum.SetUseOriginPlane( true );
}
示例2: Merge
public void Merge( AxisAlignedBox boxBounds, Sphere sphereBounds, Camera cam, bool receiver )
{
aabb.Merge( boxBounds );
if ( receiver )
receiverAabb.Merge( boxBounds );
Real camDistToCenter = ( cam.DerivedPosition - sphereBounds.Center ).Length;
minDistance = System.Math.Min( minDistance, System.Math.Max( (Real)0, camDistToCenter - sphereBounds.Radius ) );
maxDistance = System.Math.Max( maxDistance, camDistToCenter + sphereBounds.Radius );
}
示例3: OctreeZone
public OctreeZone( PCZSceneManager creator, string name )
: base( creator, name )
{
mZoneTypeName = "ZoneType_Octree";
// init octree
AxisAlignedBox b = new AxisAlignedBox( new Vector3( -10000, -10000, -10000 ), new Vector3( 10000, 10000, 10000 ) );
int depth = 8;
rootOctree = null;
Init( b, depth );
}
示例4: ThingRendable
/// <summary>
/// Default ctor.
/// </summary>
/// <param name="radius">Radius of orbits</param>
/// <param name="count">Number of quads</param>
/// <param name="qSize">Size of quads</param>
public ThingRendable( float radius, int count, float qSize )
{
this.radius = radius;
this.count = count;
this.qSize = qSize;
box = new AxisAlignedBox( new Vector3( -radius, -radius, -radius ), new Vector3( radius, radius, radius ) );
Initialize();
FillBuffer();
}
示例5: TestMergePoint
public void TestMergePoint()
{
AxisAlignedBox actual = new AxisAlignedBox( new Vector3(0,0,0), new Vector3(50,50,50));
AxisAlignedBox expected = new AxisAlignedBox(new Vector3(0, 0, 0), new Vector3(150, 150, 150));
Vector3 point = new Vector3(150, 150, 150);
actual.Merge(point);
Assert.AreEqual(expected, actual);
}
示例6: VolumeRendable
/// <summary>
///
/// </summary>
/// <param name="slices"></param>
/// <param name="size"></param>
/// <param name="texture"></param>
public VolumeRendable( int slices, int size, string texture )
{
this.slices = slices;
this.size = size;
this.texture = texture;
this.radius = Utility.Sqrt( size*size + size*size + size*size )/2.0f;
box = new AxisAlignedBox( new Vector3( -size, -size, -size ), new Vector3( size, size, size ) );
CastShadows = false;
Initialize();
}
示例7: Init
public void Init( AxisAlignedBox box, int depth )
{
if ( null != rootOctree )
rootOctree = null;
rootOctree = new Octree( this, null );
maxDepth = depth;
this.box = box;
rootOctree.Box = box;
Vector3 min = box.Minimum;
Vector3 max = box.Maximum;
rootOctree.HalfSize = ( max - min ) / 2;
}
示例8: IsObjectVisible
// this version checks against extra culling planes
public new bool IsObjectVisible( AxisAlignedBox bound, out FrustumPlane culledBy )
{
culledBy = FrustumPlane.None;
// Null boxes always invisible
if ( bound.IsNull )
{
return false;
}
// infinite boxes always visible
if ( bound.IsInfinite )
{
return true;
}
// Make any pending updates to the calculated frustum planes
UpdateFrustumPlanes();
// check extra culling planes
bool extraResults;
extraResults = this.extraCullingFrustum.IsObjectVisible( bound );
if ( !extraResults )
{
return false;
}
// check "regular" camera frustum
bool regcamresults = base.IsObjectVisible( bound, out culledBy );
if ( !regcamresults )
{
// culled by regular culling planes
return regcamresults;
}
return true;
}
示例9: FindNodes
/* Functions for finding Nodes that intersect various shapes */
public abstract void FindNodes( AxisAlignedBox t, ref List<PCZSceneNode> list, List<Portal> visitedPortals,
bool includeVisitors, bool recurseThruPortals, PCZSceneNode exclude );
示例10: FindNodes
public void FindNodes( AxisAlignedBox box, SceneNodeCollection sceneNodeList, SceneNode exclude, bool full, Octree octant )
{
List<OctreeNode> localList = new List<OctreeNode>();
if ( octant == null )
{
octant = this.octree;
}
if ( !full )
{
AxisAlignedBox obox = octant.CullBounds;
Intersection isect = this.Intersect( box, obox );
if ( isect == Intersection.Outside )
{
return;
}
full = ( isect == Intersection.Inside );
}
foreach ( OctreeNode node in octant.NodeList.Values )
{
if ( node != exclude )
{
if ( full )
{
localList.Add( node );
}
else
{
Intersection nsect = this.Intersect( box, node.WorldAABB );
if ( nsect != Intersection.Outside )
{
localList.Add( node );
}
}
}
}
if ( octant.Children[ 0, 0, 0 ] != null )
FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 0, 0, 0 ] );
if ( octant.Children[ 1, 0, 0 ] != null )
FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 1, 0, 0 ] );
if ( octant.Children[ 0, 1, 0 ] != null )
FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 0, 1, 0 ] );
if ( octant.Children[ 1, 1, 0 ] != null )
FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 1, 1, 0 ] );
if ( octant.Children[ 0, 0, 1 ] != null )
FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 0, 0, 1 ] );
if ( octant.Children[ 1, 0, 1 ] != null )
FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 1, 0, 1 ] );
if ( octant.Children[ 0, 1, 1 ] != null )
FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 0, 1, 1 ] );
if ( octant.Children[ 1, 1, 1 ] != null )
FindNodes( box, sceneNodeList, exclude, full, octant.Children[ 1, 1, 1 ] );
}
示例11: AddBoundingBox
/// <summary>
/// Adds a bounding box to draw if turned on.
/// </summary>
protected void AddBoundingBox( AxisAlignedBox aab, bool visible )
{
}
示例12: Init
public void Init( AxisAlignedBox box, int depth )
{
rootSceneNode = new OctreeNode( this, "SceneRoot" );
rootSceneNode.SetAsRootNode();
defaultRootNode = rootSceneNode;
maxDepth = depth;
octree = new Octree( null );
octree.Box = box;
Vector3 Min = box.Minimum;
Vector3 Max = box.Maximum;
octree.HalfSize = ( Max - Min ) / 2;
numObjects = 0;
Vector3 scalar = new Vector3( 1.5f, 1.5f, 1.5f );
scaleFactor.Scale = scalar;
}
示例13: Resize
/*public void AddOctreeNode(OctreeNode node, Octree octree)
{
}*/
/** Resizes the octree to the given size */
public void Resize( AxisAlignedBox box )
{
NodeCollection nodes = new NodeCollection();
FindNodes( this.octree.Box, base.sceneNodeList, null, true, this.octree );
octree = new Octree( null );
octree.Box = box;
foreach ( OctreeNode node in nodes.Values )
{
node.Octant = null;
UpdateOctreeNode( node );
}
}
示例14: Intersection
/// <summary>
/// Calculate the area of intersection of this box and another
/// </summary>
public AxisAlignedBox Intersection( AxisAlignedBox b2 )
{
if( !Intersects( b2 ) )
{
return new AxisAlignedBox();
}
Vector3 intMin = Vector3.Zero;
Vector3 intMax = Vector3.Zero;
Vector3 b2max = b2.maxVector;
Vector3 b2min = b2.minVector;
if( b2max.x > maxVector.x && maxVector.x > b2min.x )
{
intMax.x = maxVector.x;
}
else
{
intMax.x = b2max.x;
}
if( b2max.y > maxVector.y && maxVector.y > b2min.y )
{
intMax.y = maxVector.y;
}
else
{
intMax.y = b2max.y;
}
if( b2max.z > maxVector.z && maxVector.z > b2min.z )
{
intMax.z = maxVector.z;
}
else
{
intMax.z = b2max.z;
}
if( b2min.x < minVector.x && minVector.x < b2max.x )
{
intMin.x = minVector.x;
}
else
{
intMin.x = b2min.x;
}
if( b2min.y < minVector.y && minVector.y < b2max.y )
{
intMin.y = minVector.y;
}
else
{
intMin.y = b2min.y;
}
if( b2min.z < minVector.z && minVector.z < b2max.z )
{
intMin.z = minVector.z;
}
else
{
intMin.z = b2min.z;
}
return new AxisAlignedBox( intMin, intMax );
}
示例15: Intersect
public Intersection Intersect( Sphere sphere, AxisAlignedBox box )
{
intersect++;
float Radius = sphere.Radius;
Vector3 Center = sphere.Center;
Vector3[] Corners = box.Corners;
float s = 0;
float d = 0;
int i;
bool Partial;
Radius *= Radius;
Vector3 MinDistance = ( Corners[ 0 ] - Center );
Vector3 MaxDistance = ( Corners[ 4 ] - Center );
if ( ( MinDistance.LengthSquared < Radius ) && ( MaxDistance.LengthSquared < Radius ) )
{
return Intersection.Inside;
}
//find the square of the distance
//from the sphere to the box
for ( i = 0; i < 3; i++ )
{
if ( Center[ i ] < Corners[ 0 ][ i ] )
{
s = Center[ i ] - Corners[ 0 ][ i ];
d += s * s;
}
else if ( Center[ i ] > Corners[ 4 ][ i ] )
{
s = Center[ i ] - Corners[ 4 ][ i ];
d += s * s;
}
}
Partial = ( d <= Radius );
if ( !Partial )
{
return Intersection.Outside;
}
else
{
return Intersection.Intersect;
}
}