Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Structure CircleF
- Private _Diameter As Single
- Private _Radius As Single
- Private _X As Single
- Private _Y As Single
- 'Takes 3 singles and creates a new circle
- Public Sub New(ByVal X As Single,
- ByVal Y As Single,
- ByVal Radius As Single)
- _Diameter = Radius * 2
- _Radius = Radius
- _X = X
- _Y = Y
- End Sub
- 'Returns or sets the radius of the circle
- Public Property Radius() As Single
- Get
- Return _Radius
- End Get
- Set(value As Single)
- _Radius = value
- _Diameter = _Radius * 2
- End Set
- End Property
- 'Returns the Diameter length
- Public ReadOnly Property Diameter() As Single
- Get
- Return _Diameter
- End Get
- End Property
- 'Returns or sets the center coordinates of the circle
- Public Property X() As Single
- Get
- Return _X
- End Get
- Set(value As Single)
- _X = value
- End Set
- End Property
- 'Returns or sets the center coordinates of the circle
- Public Property Y() As Single
- Get
- Return _Y
- End Get
- Set(value As Single)
- _Y = value
- End Set
- End Property
- 'Returns the center coordinates of the circle
- Public ReadOnly Property Center() As PointF
- Get
- Return New PointF(_X, _Y)
- End Get
- End Property
- 'Returns whether this circle intersects with another circle
- Public Function IntersectsWith(ByVal C2 As CircleF) As Boolean
- If (_Radius + C2.Radius) ^ 2 >= ((_X - C2.X) ^ 2) + ((_Y - C2.Y) ^ 2) Then Return True
- Return False
- End Function
- 'Returns whether this circle contains a given point
- Public Function Contains(ByVal Point As PointF) As Boolean
- If _Radius ^ 2 >= ((_X - Point.X) ^ 2) + ((_Y - Point.Y) ^ 2) Then Return True
- Return False
- End Function
- End Structure
Advertisement
Add Comment
Please, Sign In to add comment