• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# AABB类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AABB的典型用法代码示例。如果您正苦于以下问题:C# AABB类的具体用法?C# AABB怎么用?C# AABB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AABB类属于命名空间,在下文中一共展示了AABB类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: computeAABB

        public override void computeAABB(AABB aabb, Transform xf, int childIndex)
        {
            Debug.Assert(childIndex < m_count);
            Vec2 lower = aabb.lowerBound;
            Vec2 upper = aabb.upperBound;

            int i1 = childIndex;
            int i2 = childIndex + 1;
            if (i2 == m_count)
            {
                i2 = 0;
            }

            Vec2 vi1 = m_vertices[i1];
            Vec2 vi2 = m_vertices[i2];
            Rot xfq = xf.q;
            Vec2 xfp = xf.p;
            float v1x = (xfq.c*vi1.x - xfq.s*vi1.y) + xfp.x;
            float v1y = (xfq.s*vi1.x + xfq.c*vi1.y) + xfp.y;
            float v2x = (xfq.c*vi2.x - xfq.s*vi2.y) + xfp.x;
            float v2y = (xfq.s*vi2.x + xfq.c*vi2.y) + xfp.y;

            lower.x = v1x < v2x ? v1x : v2x;
            lower.y = v1y < v2y ? v1y : v2y;
            upper.x = v1x > v2x ? v1x : v2x;
            upper.y = v1y > v2y ? v1y : v2y;
        }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:27,代码来源:ChainShape.cs


示例2: GetBodyAtMouse

    public virtual Body GetBodyAtMouse(bool includeStatic)
    {
        // Make a small box
        mousePVec.X = MouseXWorldPhys;
        mousePVec.Y = MouseYWorldPhys;
        FVector2 lowerBound = new FVector2(MouseXWorldPhys - 0.001f, MouseYWorldPhys - 0.001f);
        FVector2 upperBound = new FVector2(MouseXWorldPhys + 0.001f, MouseYWorldPhys + 0.001f);
        AABB aabb = new AABB(lowerBound, upperBound);
        Body body = null;

        // Query the world for overlapping shapes
        System.Func<Fixture, bool> GetBodyCallback = delegate (Fixture fixture0)
        {
            Shape shape = fixture0.Shape;
            if(fixture0.Body.BodyType != BodyType.Static || includeStatic)
            {
                FarseerPhysics.Common.Transform transform0;
                fixture0.Body.GetTransform(out transform0);
                bool inside = shape.TestPoint(ref transform0, ref mousePVec);
                if(inside)
                {
                    body = fixture0.Body;
                    return false;
                }
            }
            return true;
        };
        FSWorldComponent.PhysicsWorld.QueryAABB(GetBodyCallback, ref aabb);
        return body;
    }
开发者ID:rllamas,项目名称:Quantum,代码行数:30,代码来源:FSMouseTest.cs


示例3: CalculateBounds

        public void CalculateBounds()
        {
            Bounds = new AABB
            {
                Max = Zone.ZoneMax.ToVector3(),
                Min = Zone.ZoneMin.ToVector3()
            };

            Max = Bounds.Max;
            Min = Bounds.Min;

            // Create a persistable way to uniquely identify a scene at a location
            SceneHash = string.Format("{0}_[{1},{2}][{3},{4}]", _scene.Name, Min.X, Min.Y, Max.X, Max.Y);

            EdgeLength = Bounds.Max.X - Bounds.Min.X / 2;
            HalfEdgeLength = EdgeLength / 2;
            
            SouthWest = new Vector3(Bounds.Max.X, Bounds.Min.Y, 0);
            SouthEast = new Vector3(Bounds.Max.X, Bounds.Max.Y, 0);
            NorthWest = new Vector3(Bounds.Min.X, Bounds.Min.Y, 0);
            NorthEast = new Vector3(Bounds.Min.X, Bounds.Max.Y, 0);
            CenterX = Bounds.Min.X + (Bounds.Max.X - Bounds.Min.X) / 2;
            CenterY = Bounds.Min.Y + (Bounds.Max.Y - Bounds.Min.Y) / 2;
            Center = new Vector3(CenterX, CenterY, 0);            
        }
开发者ID:MGramolini,项目名称:Trinity,代码行数:25,代码来源:TrinityScene.cs


示例4: MouseDown

        /// <summary>
        /// Handles what happens when a user clicks the mouse
        /// </summary>
        /// <param name="p">
        /// The position of the mouse click in relative coordinates.
        /// </param>
        public void MouseDown(Vector point)
        {
            Vector p = RelativeToWorld(point);

            if (mouseJoint != null)
                throw new Exception("ASSERT: mouseJoint should be null");

            // Make a small box.
            Vector d = new Vector(.001f, .001f);
            AABB aabb = new AABB(p - d, p + d);

            // Query the world for overlapping shapes.
            IList<Shape> shapes = world.Query(aabb);
            Body body = null;
            foreach (Shape shape in shapes)
            {
                if (shape.Body.Static == false &&
                    shape.TestPoint(shape.Body.GetXForm(), p))
                {
                    body = shape.Body;
                    break;
                }
            }

            if (body != null)
            {
                MouseJointDef md = new MouseJointDef();
                md.Body1 = world.GetGroundBody();
                md.Body2 = body;
                md.Target = p;
                md.MaxForce = 1000 * body.Mass;
                mouseJoint = new MouseJoint(world.CreateJoint(md));
                body.WakeUp();
            }
        }
开发者ID:X-Ray-Jin,项目名称:Box2D,代码行数:41,代码来源:Test.cs


示例5: DensityRegion

 // DensityRegion Public Methods
 public DensityRegion(Spectrum sa, Spectrum ss, float gg, Spectrum emit, AABB b) {
     sig_a = sa;
     sig_s = ss;
     le = emit;
     g = gg;
     worldBound = b;
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:8,代码来源:Core.cs


示例6: WorldBound

 public AABB WorldBound(Point[] vertices)
 {
     var pts = vertices;
     var res = new AABB(pts[this.v0.VertexIndex], pts[this.v1.VertexIndex]);
     res.Union(pts[v2.VertexIndex]);
     return res;
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:7,代码来源:TriangleDataInfo.cs


示例7: NavCell

 public NavCell(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int flags)
 {
     BoundingBox = new AABB(
         new Vector3f(minX, minY, minZ),
         new Vector3f(maxX, maxY, maxZ));
     Flags = (NavCellFlags)flags;
 }
开发者ID:jhurliman,项目名称:d3research,代码行数:7,代码来源:NavCell.cs


示例8: WorldBound

 public AABB WorldBound(Point[] vertices)
 {
     var pts = vertices;
     var res = new AABB(pts[this.v0], pts[this.v1]);
     res.Union(pts[v2]);
     return res;
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:7,代码来源:TriangleInfo.cs


示例9: ExploreCell

 public ExploreCell(AABB aabb, List<Cell> cells, Vec3 position, int id = -1)
     : base(aabb.Min.X, aabb.Min.Y, 0, aabb.Max.X, aabb.Max.Y, 0, MovementFlag.None, id)
 {
     InitExploreCell();
     Position = position;
     Cells = cells;            
 }
开发者ID:InjectionDev,项目名称:Dev.D3,代码行数:7,代码来源:ExploreCell.cs


示例10: QuadTreeBroadPhase

 /// <summary>
 /// Creates a new quad tree broadphase with the specified span.
 /// </summary>
 /// <param name="span">the maximum span of the tree (world size)</param>
 public QuadTreeBroadPhase(AABB span)
 {
     _quadTree = new QuadTree<FixtureProxy>(span, 5, 10);
     _idRegister = new Dictionary<int, Element<FixtureProxy>>();
     _moveBuffer = new List<Element<FixtureProxy>>();
     _pairBuffer = new List<Pair>();
 }
开发者ID:kyallbarrows,项目名称:Cinch_4-3,代码行数:11,代码来源:QuadTreeBroadPhase.cs


示例11: GetFatAABB

 public void GetFatAABB(int proxyID, out AABB aabb)
 {
     if (_idRegister.ContainsKey(proxyID))
         aabb = _idRegister[proxyID].Span;
     else
         throw new KeyNotFoundException("proxyID not found in register");
 }
开发者ID:kyallbarrows,项目名称:Cinch_4-3,代码行数:7,代码来源:QuadTreeBroadPhase.cs


示例12: createProxy

 public int createProxy(AABB aabb, object userData)
 {
     int proxyId = m_tree.createProxy(aabb, userData);
     ++m_proxyCount;
     bufferMove(proxyId);
     return proxyId;
 }
开发者ID:Nomad1,项目名称:sharpbox2d,代码行数:7,代码来源:DefaultBroadPhaseBuffer.cs


示例13: KdTreePhotonMap

 public KdTreePhotonMap(int max) {
     this.max_photons = max;
     this.prev_scale = 1;
     this.photonsCount = 0;
     this.bbox = new AABB();
     this.photons = new Photon[max];
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:7,代码来源:KdTreePhotonMap.cs


示例14: DungeonRoom

    public DungeonRoom(int id, AABB b)
    {
        boundary = b;

        this.id = id;
        this.color = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f));
        this.tiles = new List<DungeonTile>();
    }
开发者ID:snaptothegrid,项目名称:Tilebase,代码行数:8,代码来源:DungeonRoom.cs


示例15: SetProxyAABB

 public void SetProxyAABB(BroadphaseProxy proxy, ref AABB aabb)
 {
     // maintain the uniform grid as the aabb moves. this works by removing
     // the stale aabb proxies and then adding the fresh aabb proxies.
     RemoveProxyFromCells(proxy);
     proxy.AABB = aabb;
     AddProxyToCells(proxy);
 }
开发者ID:Raidenthequick,项目名称:delta,代码行数:8,代码来源:UniformGridBroadphase.cs


示例16: Placement

 public override EPlacement Placement(AABB bound)
 {
     EPlacement ap = a.Placement(bound);
     EPlacement bp = b.Placement(bound);
     if (ap == EPlacement.BInsideA || bp == EPlacement.BInsideA) return EPlacement.BInsideA; //this one isn't quite right, might be BInsideA also if there's an intersection
     if (ap == EPlacement.Outside && bp == EPlacement.Outside) return EPlacement.Outside;
     if (ap == EPlacement.AInsideB && bp == EPlacement.AInsideB) return EPlacement.AInsideB;
     return EPlacement.Intersect;
 }
开发者ID:Keldyn,项目名称:BattleOfTheClans,代码行数:9,代码来源:Union.cs


示例17: BoundingBox

 public AABB BoundingBox()
 {
     var bbox = new AABB();
     foreach (var vertex in Vertices)
     {
         bbox.Union(vertex);
     }
     return bbox;
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:9,代码来源:SceneGeometryInfo.cs


示例18: log2

    private QuadTree<FixtureProxy>[] _quadTrees; // array indexed by log2(Fixture.Category)

    #endregion Fields

    #region Constructors

    /// <summary>
    /// Creates a new quad tree broadphase with the specified span.
    /// </summary>
    /// <param name="span">world size</param>
    public QuadTreeBroadPhase(AABB span)
    {
        var fatSpan = span.Fattened;
        _quadTrees = new QuadTree<FixtureProxy>[32];
        for (int i=0;i<_quadTrees.Length;i++) _quadTrees[i] = new QuadTree<FixtureProxy>(fatSpan, 5, 10);
        _idRegister = new Dictionary<int, Element<FixtureProxy>>();
        _moveBuffer = new List<Element<FixtureProxy>>();
        _pairBuffer = new List<Pair>();
    }
开发者ID:vvnurmi,项目名称:assaultwing,代码行数:19,代码来源:QuadTreeBroadPhase.cs


示例19: Start

	// Use this for initialization
	void Start ()
	{
		Vector3 p = transform.position;
		FVector2 aa = new FVector2(p.x + StartPoint.x, p.y + StartPoint.y);
		FVector2 bb = new FVector2(p.x + EndPoint.x, p.y + EndPoint.y);
		aabb = new AABB(aa, bb);
		buoyancyController = new BuoyancyController(aabb, Density, LinearDragCoef, RotationalDragCoef, FSWorldComponent.PhysicsWorld.Gravity);
		FSWorldComponent.PhysicsWorld.AddController(buoyancyController);
	}
开发者ID:frotein,项目名称:TinyUniverse,代码行数:10,代码来源:FSBuoyancyComponent.cs


示例20: SingleScatteringIntegrator

     SingleScatteringIntegrator(AABB bbox, float step, float prob,
                                RgbSpectrum inScattering, RgbSpectrum emission)
 {
     region = bbox;
     stepSize = step;
     rrProb = prob;
     sig_s = inScattering;
     lightEmission = emission;
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:9,代码来源:SingleScatteringIntegrator.cs



注:本文中的AABB类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AC类代码示例发布时间:2022-05-24
下一篇:
C# AA类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap