1
This commit is contained in:
@@ -113,6 +113,10 @@ public:
|
||||
assert(i < _w);
|
||||
return _ptrLine[j][i];
|
||||
}
|
||||
const T& Get(const PointU& xy) const
|
||||
{
|
||||
return Get(xy[1], xy[0]);
|
||||
}
|
||||
T& GetRef(size_t j, size_t i)
|
||||
{
|
||||
assert(j < _ptrLine.size());
|
||||
|
||||
@@ -375,10 +375,8 @@ std::array<T, N> Normalize(const std::array<T, N>& v)
|
||||
/**
|
||||
* @brief 返回圆形范围的节点,考虑越界
|
||||
* @param[in] rad 传入0返回1个节点、传入1返回4个节点、传入2返回13个节点,依次类推
|
||||
* @todo 暂未测试
|
||||
*/
|
||||
std::vector<PointU> GetCircle(const Size& size, const PointU& xy, unsigned rad);
|
||||
|
||||
/**
|
||||
* @brief 返回圆形范围的节点,不考虑越界
|
||||
* @param[in] rad 传入0返回1个节点、传入1返回4个节点、传入2返回13个节点,依次类推
|
||||
|
||||
@@ -158,10 +158,19 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Point ExPoint(const Point& p0, const Point& p1)
|
||||
{
|
||||
return { Int(p0[0], p1[0]), Int(p0[1], p1[1]) };
|
||||
}
|
||||
static PointU ExPointU(const PointU& p0, const PointU& p1)
|
||||
{
|
||||
return { Uint(p0[0], p1[0]), Uint(p0[1], p1[1]) };
|
||||
}
|
||||
static Position ExDirection()
|
||||
{
|
||||
float r = Random::Angle();
|
||||
return { std::cos(r), std::sin(r)};
|
||||
}
|
||||
/**
|
||||
* @brief 返回百分比命中
|
||||
*/
|
||||
@@ -169,6 +178,13 @@ public:
|
||||
{
|
||||
return Int(0, 99) < 50;
|
||||
}
|
||||
/**
|
||||
* @brief 返回角度(弧度制)
|
||||
*/
|
||||
static float Angle(float min = 0, float max = 3.1415926f * 2.0f)
|
||||
{
|
||||
return Float(min, max);
|
||||
}
|
||||
|
||||
//! 一般不使用,传给标准库接口才使用
|
||||
static std::default_random_engine& GetEngine()
|
||||
|
||||
+1
-1
Submodule project/hs updated: aa0f81092f...5a690d4c43
Reference in New Issue
Block a user