本文整理汇总了C++中FixedArray::size方法的典型用法代码示例。如果您正苦于以下问题:C++ FixedArray::size方法的具体用法?C++ FixedArray::size怎么用?C++ FixedArray::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FixedArray
的用法示例。
在下文中一共展示了FixedArray::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: A
NODE_IMPLEMENTATION(transpose_mXX, Pointer)
{
FixedArray* Aarray = NODE_ARG_OBJECT(0, FixedArray);
const Class* mtype = static_cast<const Class*>(Aarray->type());
FixedArray* Carray = static_cast<FixedArray*>(ClassInstance::allocate(mtype));
EigenMatXf A(Aarray->data<float>(), Aarray->size(0), Aarray->size(1));
EigenMatXf C(Carray->data<float>(), Aarray->size(0), Aarray->size(1));
C = A.transpose();
NODE_RETURN(Carray);
}
示例2: int
TEST(Containers, ArrayBool)
{
FixedArray<20, bool> array;
FixedArray<20, bool> &cref = array;
EXPECT_TRUE(array.empty());
EXPECT_TRUE(cref.empty());
EXPECT_EQ(array.size(), 0);
EXPECT_EQ(cref.size(), 0);
EXPECT_TRUE(array.push_back(true));
EXPECT_FALSE(array.empty());
EXPECT_FALSE(cref.empty());
EXPECT_EQ(array.front(), true);
EXPECT_EQ(cref.front(), true);
EXPECT_TRUE(array.pop_back());
EXPECT_FALSE(array.pop_back());
EXPECT_TRUE(array.empty());
EXPECT_TRUE(cref.empty());
EXPECT_TRUE(array.push_back(false));
EXPECT_TRUE(array.push_back(true));
EXPECT_EQ(array.front(), false);
EXPECT_EQ(cref.front(), false);
EXPECT_EQ(array.back(), true);
EXPECT_EQ(cref.back(), true);
EXPECT_EQ(array.size(), 2);
EXPECT_EQ(cref.size(), 2);
array.clear();
EXPECT_EQ(array.size(), 0);
EXPECT_TRUE(array.empty());
for(unsigned i=0; i< array.capacity(); i++)
EXPECT_TRUE(array.push_back(i & 1));
EXPECT_FALSE(array.push_back(-1));
for(unsigned i=0; i < array.capacity(); i++)
{
EXPECT_EQ(array[i], int(i & 1));
EXPECT_EQ(cref[i], int(i & 1));
}
for(unsigned i=0; i < array.capacity(); i++)
{
EXPECT_EQ(array.back(), int(array.capacity() - 1 - i) & 1);
EXPECT_EQ(cref.back(), int(cref.capacity() - 1 - i) & 1);
EXPECT_TRUE(array.pop_back());
}
}
示例3:
Rect BoundingBox::project2D(const Matrix4x4& projection) const
{
Vector3 projMin = min;
Vector3 projMax = max;
// 2+------+3
// /| /|
// / | / |
// / 0+---/--+1
// 6+------+7 /
// | / | /
// |/ |/
// 4+------+5
FixedArray<Vector4, 8> corners;
corners[0] = Vector4(projMin, 1.0);
corners[1] = Vector4(projMax.x, projMin.y, projMin.z, 1.0);
corners[2] = Vector4(projMin.x, projMax.y, projMin.z, 1.0);
corners[3] = Vector4(projMax.x, projMax.y, projMin.z, 1.0);
corners[4] = Vector4(projMin.x, projMin.y, projMax.z, 1.0);
corners[5] = Vector4(projMax.x, projMin.y, projMax.z, 1.0);
corners[6] = Vector4(projMin.x, projMax.y, projMax.z, 1.0);
corners[7] = Vector4(projMax, 1.0);
Rect rect;
for(unsigned int i = 0; i < corners.size(); ++i)
{
Vector4 projected = projection * corners[i];
rect.mergePoint(Vector2(projected.x / projected.w, projected.y / projected.w));
}
return rect;
}