亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? utils.vb

?? 一個(gè).Net下用VB編寫的用于游戲的人工智能引擎
?? VB
字號(hào):
Public Class Utils
    Public Const Pi As Double = Math.PI
    Public Const TwoPi As Double = Pi * 2
    Public Const RAND_MAX As Integer = &H7FFF
    Public Const HalfPi As Double = Pi / 2

    Public Shared Function RandInRange(ByVal x As Double, ByVal y As Double) As Double
        Return x + RandFloat() * (y - x)
    End Function

    Public Shared Function RandFloat() As Double
        Dim r As New Random
        Return r.NextDouble / (RAND_MAX + 1.0)
    End Function

    '//returns a random double in the range -1 < n < 1
    Public Shared Function RandomClamped() As Double
        Return RandFloat() - RandFloat()
    End Function

    Public Shared Function isEqual(ByVal a As Double, ByVal b As Double) As Boolean
        If (Math.Abs(a - b) < 0.000000000001) Then
            Return True
        End If

        Return False
    End Function

    Public Shared Function RandInt(ByVal x As Integer, ByVal y As Integer) As Integer
        Dim r As New Random
        Return r.Next Mod (y - x + 1) + x
    End Function

    '//------------------------- Overlapped -----------------------------------
    '//
    '//  tests to see if an entity is overlapping any of a number of entities
    '//  stored in a std container
    '//------------------------------------------------------------------------
    Public Shared Function Overlapped(ByVal ob As BaseGameEntity, ByVal conOb As ArrayList, ByVal MinDistBetweenObstacles As Double) As Boolean
        Dim i As Integer
        For i = 0 To conOb.Count - 1
            If (Geometry.TwoCirclesOverlapped(ob.Pos(), ob.BRadius() + MinDistBetweenObstacles, CType(conOb(i), BaseGameEntity).Pos(), CType(conOb(i), BaseGameEntity).BRadius())) Then
                Return True
            End If
        Next
        Return False
    End Function

    '//----------------------- TagNeighbors ----------------------------------
    '//
    '//  tags any entities contained in a std container that are within the
    '//  radius of the single entity parameter
    '//------------------------------------------------------------------------
    Public Shared Sub TagNeighbors(ByVal entity As BaseGameEntity, ByVal ContainerOfEntities As ArrayList, ByVal radius As Double)
        '//iterate through all entities checking for range
        Dim i As Integer
        Dim curEntity As BaseGameEntity
        For i = 0 To ContainerOfEntities.Count - 1
            curEntity = ContainerOfEntities(i)
            '//first clear any current tag
            curEntity.UnTag()

            Dim to1 As Vector2D = curEntity.Pos().Minus(entity.Pos())

            '//the bounding radius of the other is taken into account by adding it 
            '//to the range
            Dim range As Double = radius + curEntity.BRadius()

            '//if entity within range, tag for further consideration. (working in
            '//distance-squared space to avoid sqrts)
            If (Not curEntity Is entity) And (to1.LengthSQ() < range * range) Then
                curEntity.Tag()
            End If
        Next
    End Sub

    '//------------------- EnforceNonPenetrationConstraint ---------------------
    '//
    '//  Given a pointer to an entity and a std container of pointers to nearby
    '//  entities, this function checks to see if there is an overlap between
    '//  entities. If there is, then the entities are moved away from each
    '//  other
    '//------------------------------------------------------------------------
    Public Shared Sub EnforceNonPenetrationConstraint(ByVal entity As BaseGameEntity, ByVal ContainerOfEntities As ArrayList)
        '//iterate through all entities checking for any overlap of bounding radii
        Dim i As Integer
        Dim curEntity As BaseGameEntity
        For i = 0 To ContainerOfEntities.Count - 1
            curEntity = ContainerOfEntities(i)
            If Not curEntity Is entity Then
                '//calculate the distance between the positions of the entities
                Dim ToEntity As Vector2D = entity.Pos().Minus(curEntity.Pos())

                Dim DistFromEachOther As Double = ToEntity.Length()

                '//if this distance is smaller than the sum of their radii then this
                '//entity must be moved away in the direction parallel to the
                '//ToEntity vector   
                Dim AmountOfOverLap As Double = curEntity.BRadius() + entity.BRadius() - DistFromEachOther

                If (AmountOfOverLap >= 0) Then
                    '//move the entity a distance away equivalent to the amount of overlap.
                    entity.Pos = entity.Pos().Plus(ToEntity.Divided(DistFromEachOther).Mutiply(AmountOfOverLap))
                End If

            End If
        Next
    End Sub

    '//-------------------- GetEntityLineSegmentIntersections ----------------------
    '//
    '//  tests a line segment AB against a container of entities. First of all
    '//  a test is made to confirm that the entity is within a specified range of 
    '//  the one_to_ignore (positioned at A). If within range the intersection test
    '//  is made.
    '//
    '//  returns a list of all the entities that tested positive for intersection
    '//-----------------------------------------------------------------------------
    Public Shared Function GetEntityLineSegmentIntersections(ByVal entities As ArrayList, ByVal the_one_to_ignore As Integer, ByVal A As Vector2D, ByVal B As Vector2D, ByVal range As Double) As ArrayList
        Dim it As BaseGameEntity

        Dim hits As New ArrayList
        Dim i As Integer
        '//iterate through all entities checking against the line segment AB
        For i = 0 To entities.Count - 1
            '//if not within range or the entity being checked is the_one_to_ignore
            '//just continue with the next entity
            it = entities(i)
            If Not ((it.ID() = the_one_to_ignore) Or (Vector2D.Vec2DDistanceSQ(it.Pos(), A) > range * range)) Then
                '//if the distance to AB is less than the entities bounding radius then
                '//there is an intersection so add it to hits
                If Geometry.DistToLineSegment(A, B, it.Pos()) < it.BRadius() Then hits.Add(it)

            End If

        Next
        Return hits

    End Function

    '//------------------------ GetClosestEntityLineSegmentIntersection ------------
    '//
    '//  tests a line segment AB against a container of entities. First of all
    '//  a test is made to confirm that the entity is within a specified range of 
    '//  the one_to_ignore (positioned at A). If within range the intersection test
    '//  is made.
    '//
    '//  returns the closest entity that tested positive for intersection or NULL
    '//  if none found
    '//-----------------------------------------------------------------------------

    Public Shared Function GetClosestEntityLineSegmentIntersection(ByVal entities As ArrayList, ByVal the_one_to_ignore As Integer, ByVal A As Vector2D, ByVal B As Vector2D, ByVal range As Double) As BaseGameEntity
        Dim it As BaseGameEntity

        Dim ClosestEntity As BaseGameEntity = Nothing

        Dim ClosestDist As Double = Double.MaxValue

        '//iterate through all entities checking against the line segment AB
        Dim i As Integer
        Dim distSq As Double
        For i = 0 To entities.Count - 1
            it = entities(i)
            distSq = Vector2D.Vec2DDistanceSQ(it.Pos(), A)

            '//if not within range or the entity being checked is the_one_to_ignore
            '//just continue with the next entity
            If Not ((it.ID() = the_one_to_ignore) Or (distSq > range * range)) Then
                '//if the distance to AB is less than the entities bounding radius then
                '//there is an intersection so add it to hits
                If (Geometry.DistToLineSegment(A, B, it.Pos()) < it.BRadius()) Then
                    If (distSq < ClosestDist) Then
                        ClosestDist = distSq

                        ClosestEntity = it

                    End If

                End If
            End If
        Next
        Return ClosestEntity

    End Function
End Class

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产va精品久久久不卡综合| 精品久久久久久久久久久久久久久久久| 精品久久人人做人人爱| 日韩av网站在线观看| 4438亚洲最大| 日本最新不卡在线| 日韩女优av电影| 国产传媒欧美日韩成人| 国产精品国产三级国产普通话99| 99精品视频免费在线观看| 亚洲午夜精品网| 欧美激情中文字幕| 99精品视频一区| 亚洲1区2区3区4区| 精品国产三级电影在线观看| 国产成人精品影视| 夜夜嗨av一区二区三区中文字幕| 欧美日韩视频在线一区二区| 久久精品国产久精国产| 中文字幕在线不卡| 777精品伊人久久久久大香线蕉| 韩国av一区二区三区四区| 国产精品美女一区二区在线观看| 欧美伊人久久久久久久久影院| 日本sm残虐另类| 中文幕一区二区三区久久蜜桃| 色婷婷狠狠综合| 九九**精品视频免费播放| 国产精品国产三级国产普通话三级| 欧美视频精品在线| 国产成人免费av在线| 性欧美大战久久久久久久久| 久久久久久久免费视频了| 欧美亚洲国产怡红院影院| 九色porny丨国产精品| 亚洲图片你懂的| 欧美第一区第二区| 色婷婷国产精品| 国产大陆亚洲精品国产| 午夜视频一区二区| 国产欧美一区二区精品婷婷| 欧美日韩一卡二卡| 不卡欧美aaaaa| 久久国产精品99久久久久久老狼| 一区二区三区在线免费播放| 久久嫩草精品久久久精品| 欧美日韩在线播放一区| 成人高清免费在线播放| 91久久香蕉国产日韩欧美9色| 麻豆视频一区二区| 一区二区三区精品在线观看| 国产农村妇女精品| 日韩精品一区在线| 欧美性大战久久久久久久| 波多野结衣中文字幕一区| 国产在线精品不卡| 秋霞影院一区二区| 婷婷久久综合九色国产成人| 亚洲精品一卡二卡| 亚洲国产成人自拍| 国产日韩欧美电影| 日韩欧美精品在线视频| 欧美日韩高清不卡| 在线观看日韩精品| 色综合天天做天天爱| av一区二区不卡| 国产精品123区| 国产在线日韩欧美| 日本午夜一区二区| 日本午夜一本久久久综合| 亚洲国产欧美在线| 亚洲精品免费视频| 亚洲免费在线视频| 国产精品久久久久一区二区三区| 精品国产sm最大网站免费看| 精品国产一区二区三区四区四| 日韩精品一区二区三区蜜臀| 91精品国产免费久久综合| 欧美一区二区三区系列电影| 欧美一区二区三区在| 制服.丝袜.亚洲.另类.中文| 91麻豆精品国产91久久久久久久久 | 亚洲成人综合在线| 亚洲欧洲制服丝袜| 亚洲一区成人在线| 午夜一区二区三区在线观看| 亚洲一区二区视频| 丝袜诱惑制服诱惑色一区在线观看 | 国产精品一区二区在线播放| 国产精品99久久久久| 国产不卡视频在线观看| 成人激情文学综合网| 97精品国产97久久久久久久久久久久| 91丨九色丨蝌蚪富婆spa| 色爱区综合激月婷婷| 国产欧美一区二区三区鸳鸯浴 | 欧美一级欧美三级| 日韩三级电影网址| 久久亚洲精精品中文字幕早川悠里| 精品久久国产字幕高潮| 国产欧美日韩不卡| 亚洲欧美日韩成人高清在线一区| 亚洲欧美日韩国产综合在线| 亚洲图片欧美色图| 麻豆成人在线观看| 成人午夜视频福利| 在线一区二区三区做爰视频网站| 欧美三级韩国三级日本一级| 日韩一卡二卡三卡| 国产精品私人影院| 亚洲综合久久久| 久久成人免费网| 99国产精品视频免费观看| 在线这里只有精品| 337p粉嫩大胆噜噜噜噜噜91av| 中国色在线观看另类| 一区二区欧美视频| 国产揄拍国内精品对白| av色综合久久天堂av综合| 777亚洲妇女| 国产女主播一区| 性久久久久久久久| 成人精品亚洲人成在线| 欧美日韩国产首页| 日本女人一区二区三区| 国产激情偷乱视频一区二区三区| 在线亚洲免费视频| 国产午夜三级一区二区三| 一区二区三区四区五区视频在线观看 | 欧美一区二区视频网站| 欧美激情一区三区| 日本成人在线不卡视频| 91视频精品在这里| 日韩一区二区不卡| 亚洲自拍偷拍网站| 国产成人在线视频播放| 欧美女孩性生活视频| 国产精品第四页| 国产黄色91视频| 欧美电影免费观看高清完整版在| 亚洲乱码国产乱码精品精可以看| 国产一区二区调教| 日韩天堂在线观看| 亚洲国产aⅴ成人精品无吗| av欧美精品.com| 久久精品亚洲精品国产欧美kt∨| 日韩国产欧美在线播放| 色94色欧美sute亚洲线路二| 欧美激情中文字幕| 国产原创一区二区三区| 日韩一二三区视频| 午夜伊人狠狠久久| 在线观看亚洲专区| 亚洲理论在线观看| 91免费视频网| 国产精品久久久久桃色tv| 国产综合成人久久大片91| 欧美精品18+| 午夜精品久久久久久久| 91黄色免费观看| 亚洲精品免费在线| 91久久精品国产91性色tv | 一区二区在线观看免费| 91女神在线视频| 亚洲免费在线视频一区 二区| av在线播放不卡| 国产精品不卡在线| 成人av网站大全| 亚洲色图欧美在线| 91片在线免费观看| 亚洲激情图片小说视频| 91丨九色丨国产丨porny| 国产精品久久久一本精品| 不卡高清视频专区| 亚洲欧美精品午睡沙发| 91看片淫黄大片一级| 亚洲精品老司机| 欧美日韩精品电影| 免费观看成人av| 26uuu亚洲综合色| 精品视频免费在线| 日韩成人一级片| 日韩欧美精品在线视频| 国产乱码精品一区二区三| 久久久久久久久久久久电影| 国产a久久麻豆| 亚洲日本乱码在线观看| 精品视频免费看| 久久国产精品72免费观看| 国产亚洲成年网址在线观看| 成人黄色电影在线 | 欧美日韩国产成人在线免费| 免费视频一区二区| 久久综合九色综合欧美98| 不卡的av中国片| 亚洲综合丁香婷婷六月香| 欧美一区二区三区四区在线观看 | 国产成人激情av| 亚洲精品菠萝久久久久久久| 在线综合+亚洲+欧美中文字幕|