本文整理汇总了C++中Point3dVector类的典型用法代码示例。如果您正苦于以下问题:C++ Point3dVector类的具体用法?C++ Point3dVector怎么用?C++ Point3dVector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Point3dVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST_F
TEST_F(EnergyPlusFixture,ForwardTranslator_ShadingSurface_Space)
{
Model model;
ThermalZone thermalZone(model);
Point3dVector points;
points.push_back(Point3d(0,1,0));
points.push_back(Point3d(1,1,0));
points.push_back(Point3d(1,0,0));
points.push_back(Point3d(0,0,0));
boost::optional<Space> space = Space::fromFloorPrint(points, 1, model);
ASSERT_TRUE(space);
space->setThermalZone(thermalZone);
ShadingSurfaceGroup shadingSurfaceGroup(model);
EXPECT_TRUE(shadingSurfaceGroup.setSpace(*space));
ShadingSurface shadingSurface(points, model);
EXPECT_TRUE(shadingSurface.setShadingSurfaceGroup(shadingSurfaceGroup));
ForwardTranslator forwardTranslator;
Workspace workspace = forwardTranslator.translateModel(model);
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Zone).size());
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Shading_Zone_Detailed).size());
WorkspaceObject zoneObject = workspace.getObjectsByType(IddObjectType::Zone)[0];
WorkspaceObject shadingSurfaceObject = workspace.getObjectsByType(IddObjectType::Shading_Zone_Detailed)[0];
EXPECT_TRUE(shadingSurfaceObject.getTarget(Shading_Zone_DetailedFields::BaseSurfaceName));
}
示例2: TEST_F
TEST_F(ModelFixture, ModelObject_Clone_SameModel) {
// Make model object with resource that has children
Model original;
Point3dVector points;
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
Surface surface(points, original);
Construction construction(original);
surface.setConstruction(construction);
construction.standardsInformation(); // creates object
StandardOpaqueMaterial material(original);
construction.setLayers(MaterialVector(1u,material));
EXPECT_EQ(4u,original.numObjects());
// Clone into same model -- new object with different name. resources reused.
Surface newSurface = surface.clone(original).cast<Surface>();
EXPECT_FALSE(newSurface == surface);
EXPECT_EQ(5u,original.numObjects());
EXPECT_NE(surface.name().get(),newSurface.name().get());
ASSERT_TRUE(surface.construction());
ASSERT_TRUE(newSurface.construction());
EXPECT_TRUE(surface.construction().get() == newSurface.construction().get());
EXPECT_TRUE(newSurface.construction().get().cast<LayeredConstruction>().numLayers() == 1u);
}
示例3: TEST_F
TEST_F(ModelFixture, InteriorPartitionSurface_DefaultConstruction)
{
Model model;
Space space(model);
Construction construction(model);
DefaultConstructionSet defaultConstructionSet(model);
defaultConstructionSet.setInteriorPartitionConstruction(construction);
space.setDefaultConstructionSet(defaultConstructionSet);
InteriorPartitionSurfaceGroup group(model);
group.setSpace(space);
Point3dVector points;
points.push_back(Point3d(0, 2, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
InteriorPartitionSurface surface(points, model);
EXPECT_FALSE(surface.construction());
surface.setInteriorPartitionSurfaceGroup(group);
ASSERT_TRUE(surface.construction());
EXPECT_EQ(construction.handle(), surface.construction()->handle());
}
示例4: TEST_F
TEST_F(EnergyPlusFixture,ForwardTranslator_Surface_Zone)
{
Model model;
ThermalZone thermalZone(model);
Space space(model);
space.setThermalZone(thermalZone);
Point3dVector points;
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
points.push_back(Point3d(1, 1, 0));
Surface surface(points, model);
surface.setSpace(space);
ForwardTranslator forwardTranslator;
Workspace workspace = forwardTranslator.translateModel(model);
EXPECT_EQ(0u, forwardTranslator.errors().size());
EXPECT_EQ(0u, forwardTranslator.warnings().size());
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::BuildingSurface_Detailed).size());
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Zone).size());
WorkspaceObject surfaceObject = workspace.getObjectsByType(IddObjectType::BuildingSurface_Detailed)[0];
WorkspaceObject zoneObject = workspace.getObjectsByType(IddObjectType::Zone)[0];
ASSERT_TRUE(surfaceObject.getTarget(BuildingSurface_DetailedFields::ZoneName));
EXPECT_EQ(zoneObject.handle(), surfaceObject.getTarget(BuildingSurface_DetailedFields::ZoneName)->handle());
}
示例5: circularEqual
bool circularEqual(const Point3dVector& points1, const Point3dVector& points2, double tol)
{
unsigned N = points1.size();
if (N != points2.size()){
return false;
}
if (N == 0){
return true;
}
bool result = false;
// look for a common starting point
for (unsigned i = 0; i < N; ++i){
if (getDistance(points1[0], points2[i]) <= tol){
result = true;
// check all other points
for (unsigned j = 0; j < N; ++j){
if (getDistance(points1[j], points2[(i + j) % N]) > tol){
result = false;
break;
}
}
}
if (result){
return result;
}
}
return result;
}
示例6: TEST_F
TEST_F(EnergyPlusFixture,ForwardTranslator_ThermalZone_OneZone_OneSpace_Building)
{
Model model;
Point3dVector points;
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(1, 1, 0));
points.push_back(Point3d(1, 0, 0));
SpaceType spaceType(model);
spaceType.setLightingPowerPerFloorArea(1);
Building building = model.getUniqueModelObject<Building>();
building.setSpaceType(spaceType);
ThermalZone zone(model);
Space space(model);
space.setThermalZone(zone);
Surface surface(points, model);
surface.setSpace(space);
EXPECT_EQ(1, space.floorArea());
EXPECT_EQ(1, space.lightingPowerPerFloorArea());
ForwardTranslator trans;
Workspace workspace = trans.translateModel(model);
EXPECT_EQ(1u, workspace.getObjectsByType(IddObjectType::Zone).size());
EXPECT_EQ(1u, workspace.getObjectsByType(IddObjectType::ZoneList).size());
EXPECT_EQ(1u, workspace.getObjectsByType(IddObjectType::Lights).size());
}
示例7: TEST_F
TEST_F(ModelFixture, DefaultConstructionSet_ShadingSurface)
{
Model model;
Point3dVector points;
points.push_back(Point3d(0,1,0));
points.push_back(Point3d(0,0,0));
points.push_back(Point3d(1,0,0));
ShadingSurface surface(points, model);
ShadingSurfaceGroup shadingSurfaceGroup(model);
surface.setShadingSurfaceGroup(shadingSurfaceGroup);
DefaultConstructionSet defaultConstructionSet(model);
DefaultSurfaceConstructions defaultSurfaceConstructions(model);
Construction construction(model);
EXPECT_TRUE(shadingSurfaceGroup.setShadingSurfaceType("Site"));
EXPECT_EQ("Site", shadingSurfaceGroup.shadingSurfaceType());
EXPECT_FALSE(defaultConstructionSet.siteShadingConstruction());
EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_TRUE(defaultConstructionSet.setSiteShadingConstruction(construction));
ASSERT_TRUE(defaultConstructionSet.siteShadingConstruction());
EXPECT_EQ(construction.handle(), defaultConstructionSet.siteShadingConstruction()->handle());
ASSERT_TRUE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_EQ(construction.handle(), defaultConstructionSet.getDefaultConstruction(surface)->handle());
defaultConstructionSet.resetSiteShadingConstruction();
EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_TRUE(shadingSurfaceGroup.setShadingSurfaceType("Building"));
EXPECT_EQ("Building", shadingSurfaceGroup.shadingSurfaceType());
EXPECT_FALSE(defaultConstructionSet.buildingShadingConstruction());
EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_TRUE(defaultConstructionSet.setBuildingShadingConstruction(construction));
ASSERT_TRUE(defaultConstructionSet.buildingShadingConstruction());
EXPECT_EQ(construction.handle(), defaultConstructionSet.buildingShadingConstruction()->handle());
ASSERT_TRUE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_EQ(construction.handle(), defaultConstructionSet.getDefaultConstruction(surface)->handle());
defaultConstructionSet.resetBuildingShadingConstruction();
EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_FALSE(shadingSurfaceGroup.setShadingSurfaceType("Space"));
Space space(model);
EXPECT_TRUE(shadingSurfaceGroup.setSpace(space));
EXPECT_EQ("Space", shadingSurfaceGroup.shadingSurfaceType());
EXPECT_FALSE(defaultConstructionSet.spaceShadingConstruction());
EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_TRUE(defaultConstructionSet.setSpaceShadingConstruction(construction));
ASSERT_TRUE(defaultConstructionSet.spaceShadingConstruction());
EXPECT_EQ(construction.handle(), defaultConstructionSet.spaceShadingConstruction()->handle());
ASSERT_TRUE(defaultConstructionSet.getDefaultConstruction(surface));
EXPECT_EQ(construction.handle(), defaultConstructionSet.getDefaultConstruction(surface)->handle());
defaultConstructionSet.resetSpaceShadingConstruction();
EXPECT_FALSE(defaultConstructionSet.getDefaultConstruction(surface));
}
示例8: moveVerticesTowardsPoint
std::vector<Point3d> moveVerticesTowardsPoint(const Point3dVector& vertices, const Point3d& point, double distance)
{
Point3dVector result;
for (const Point3d& vertex : vertices){
Vector3d vector = point-vertex;
vector.setLength(distance);
result.push_back(vertex+vector);
}
return result;
}
示例9: TEST_F
TEST_F(ModelFixture, DesignSpecificationOutdoorAir_ThermalZone_2DifferentSpaces)
{
Model model;
// 1 m^2
Point3dVector points;
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(1, 1, 0));
points.push_back(Point3d(1, 0, 0));
ThermalZone thermalZone(model);
DesignSpecificationOutdoorAir designSpecificationOutdoorAir1(model);
EXPECT_TRUE(designSpecificationOutdoorAir1.setOutdoorAirFlowperPerson(0.0));
EXPECT_TRUE(designSpecificationOutdoorAir1.setOutdoorAirFlowperFloorArea(2.0));
DesignSpecificationOutdoorAir designSpecificationOutdoorAir2(model);
EXPECT_TRUE(designSpecificationOutdoorAir2.setOutdoorAirFlowperPerson(3.0));
Space space1(model);
EXPECT_TRUE(space1.setThermalZone(thermalZone));
EXPECT_TRUE(space1.setDesignSpecificationOutdoorAir(designSpecificationOutdoorAir1));
Surface surface1(points, model);
surface1.setParent(space1);
EXPECT_EQ(1.0, space1.floorArea());
space1.setPeoplePerFloorArea(1.0);
EXPECT_EQ(1.0, space1.numberOfPeople());
Space space2(model);
EXPECT_TRUE(space2.setThermalZone(thermalZone));
EXPECT_TRUE(space2.setDesignSpecificationOutdoorAir(designSpecificationOutdoorAir2));
Surface surface2(points, model);
surface2.setParent(space2);
EXPECT_EQ(1.0, space2.floorArea());
space2.setPeoplePerFloorArea(2.0);
EXPECT_EQ(2.0, space2.numberOfPeople());
EXPECT_EQ(2u, model.getModelObjects<DesignSpecificationOutdoorAir>().size());
boost::optional<Space> combinedSpace = thermalZone.combineSpaces();
ASSERT_TRUE(combinedSpace);
EXPECT_FALSE(combinedSpace->isDesignSpecificationOutdoorAirDefaulted());
ASSERT_TRUE(combinedSpace->designSpecificationOutdoorAir());
EXPECT_EQ(3u, model.getModelObjects<DesignSpecificationOutdoorAir>().size());
EXPECT_NE(designSpecificationOutdoorAir1.handle(), combinedSpace->designSpecificationOutdoorAir()->handle());
EXPECT_NE(designSpecificationOutdoorAir2.handle(), combinedSpace->designSpecificationOutdoorAir()->handle());
EXPECT_EQ(1.0, combinedSpace->designSpecificationOutdoorAir()->outdoorAirFlowperFloorArea()); // (2*1 + 0*1)/2
EXPECT_EQ(2.0, combinedSpace->designSpecificationOutdoorAir()->outdoorAirFlowperPerson()); // (0*1 + 3*2)/3
}
示例10: TEST_F
TEST_F(ModelFixture, DaylightingDeviceShelf_Throw)
{
Model model;
Point3dVector points;
points.push_back(Point3d(0, 0, 1));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 1, 1));
SubSurface door(points, model);
EXPECT_TRUE(door.setSubSurfaceType("Door"));
EXPECT_EQ("Door", door.subSurfaceType());
EXPECT_EQ(0, model.getConcreteModelObjects<DaylightingDeviceShelf>().size());
bool didThrow = false;
try{
DaylightingDeviceShelf shelf(door);
}catch(const openstudio::Exception&){
didThrow = true;
}
EXPECT_TRUE(didThrow);
EXPECT_EQ(0, model.getConcreteModelObjects<DaylightingDeviceShelf>().size());
// change to a window
EXPECT_TRUE(door.setSubSurfaceType("FixedWindow"));
EXPECT_EQ("FixedWindow", door.subSurfaceType());
// first one succeeds
didThrow = false;
try{
DaylightingDeviceShelf shelf(door);
}catch(const openstudio::Exception&){
didThrow = true;
}
EXPECT_FALSE(didThrow);
EXPECT_EQ(1, model.getConcreteModelObjects<DaylightingDeviceShelf>().size());
// second call throws
didThrow = false;
try{
DaylightingDeviceShelf shelf(door);
}catch(const openstudio::Exception&){
didThrow = true;
}
EXPECT_TRUE(didThrow);
EXPECT_EQ(1, model.getConcreteModelObjects<DaylightingDeviceShelf>().size());
// changing to door removes light shelf
EXPECT_TRUE(door.setSubSurfaceType("Door"));
EXPECT_EQ("Door", door.subSurfaceType());
EXPECT_FALSE(door.daylightingDeviceShelf());
EXPECT_FALSE(door.addDaylightingDeviceShelf());
EXPECT_EQ(0, model.getConcreteModelObjects<DaylightingDeviceShelf>().size());
}
示例11: TEST_F
TEST_F(ModelFixture, ShadingSurfaceGroup_Space_Hierarchy)
{
Model model;
// add a space
Space space(model);
// add a shading surface group
ShadingSurfaceGroup group(model);
EXPECT_EQ("Building", group.shadingSurfaceType());
EXPECT_TRUE(group.setSpace(space));
EXPECT_EQ("Space", group.shadingSurfaceType());
ASSERT_TRUE(group.space());
EXPECT_EQ(space.handle(), group.space()->handle());
// make a new shading surface
Point3dVector points;
points.push_back(Point3d(0, 2, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
ShadingSurface surface(points, model);
EXPECT_TRUE(surface.setShadingSurfaceGroup(group));
ASSERT_TRUE(surface.shadingSurfaceGroup());
EXPECT_EQ(group.handle(), surface.shadingSurfaceGroup()->handle());
// check children from group
ASSERT_EQ(static_cast<unsigned>(1), group.children().size());
EXPECT_EQ(surface.handle(), group.children()[0].handle());
// now check children from space
ASSERT_EQ(static_cast<unsigned>(1), space.children().size());
EXPECT_EQ(group.handle(), space.children()[0].handle());
// check parent from group
ASSERT_TRUE(group.parent());
EXPECT_EQ(space.handle(), group.parent()->handle());
// check parent from surface
ASSERT_TRUE(surface.parent());
EXPECT_EQ(group.handle(), surface.parent()->handle());
// clone the space
ModelObject clone = space.clone(model);
OptionalSpace spaceClone = clone.optionalCast<Space>();
ASSERT_TRUE(spaceClone);
ASSERT_EQ(static_cast<unsigned>(1), spaceClone->children().size());
EXPECT_NE(group.handle(), spaceClone->children()[0].handle());
OptionalShadingSurfaceGroup cloneChild = spaceClone->children()[0].optionalCast<ShadingSurfaceGroup>();
ASSERT_TRUE(cloneChild);
ASSERT_EQ(static_cast<unsigned>(1), cloneChild->children().size());
EXPECT_NE(surface.handle(), cloneChild->children()[0].handle());
}
示例12: TEST_F
TEST_F(ModelFixture, IlluminanceMap_SpaceSetTransformation)
{
Model model;
Space space(model);
IlluminanceMap map(model);
map.setXLength(2);
map.setYLength(2);
map.setNumberofXGridPoints(2);
map.setNumberofYGridPoints(2);
map.setOriginXCoordinate(1);
map.setOriginYCoordinate(0);
map.setOriginZCoordinate(2);
map.setSpace(space);
Point3dVector testPoints = map.referencePoints();
ASSERT_EQ(4u, testPoints.size());
EXPECT_DOUBLE_EQ(0, testPoints[0].x());
EXPECT_DOUBLE_EQ(0, testPoints[0].y());
EXPECT_DOUBLE_EQ(0, testPoints[0].z());
EXPECT_DOUBLE_EQ(2, testPoints[3].x());
EXPECT_DOUBLE_EQ(2, testPoints[3].y());
EXPECT_DOUBLE_EQ(0, testPoints[3].z());
testPoints = space.transformation()*map.transformation()*map.referencePoints();
EXPECT_DOUBLE_EQ(1, testPoints[0].x());
EXPECT_DOUBLE_EQ(0, testPoints[0].y());
EXPECT_DOUBLE_EQ(2, testPoints[0].z());
EXPECT_DOUBLE_EQ(3, testPoints[3].x());
EXPECT_DOUBLE_EQ(2, testPoints[3].y());
EXPECT_DOUBLE_EQ(2, testPoints[3].z());
EXPECT_TRUE(space.setTransformation(Transformation::translation(Vector3d(1,0,0))));
testPoints = space.transformation()*map.transformation()*map.referencePoints();
EXPECT_DOUBLE_EQ(2, testPoints[0].x());
EXPECT_DOUBLE_EQ(0, testPoints[0].y());
EXPECT_DOUBLE_EQ(2, testPoints[0].z());
EXPECT_DOUBLE_EQ(4, testPoints[3].x());
EXPECT_DOUBLE_EQ(2, testPoints[3].y());
EXPECT_DOUBLE_EQ(2, testPoints[3].z());
EXPECT_TRUE(space.setTransformation(Transformation::translation(Vector3d(1,0,0))*Transformation::rotation(Vector3d(0,0,1),-openstudio::degToRad(90))));
testPoints = space.transformation()*map.transformation()*map.referencePoints();
EXPECT_DOUBLE_EQ(1, testPoints[0].x());
EXPECT_DOUBLE_EQ(-1, testPoints[0].y());
EXPECT_DOUBLE_EQ(2, testPoints[0].z());
EXPECT_DOUBLE_EQ(3, testPoints[3].x());
EXPECT_DOUBLE_EQ(-3, testPoints[3].y());
EXPECT_DOUBLE_EQ(2, testPoints[3].z());
}
示例13: TEST_F
TEST_F(ModelFixture, InteriorPartitionSurface)
{
Model model;
Point3dVector points;
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
points.push_back(Point3d(1, 1, 0));
EXPECT_NO_THROW(InteriorPartitionSurface(points, model));
InteriorPartitionSurface interiorPartitionSurface(points, model);
EXPECT_FALSE(interiorPartitionSurface.interiorPartitionSurfaceGroup());
}
示例14: TEST_F
TEST_F(ModelFixture, DaylightingDeviceShelf)
{
Model model;
// triangle with unit area
Point3dVector points;
points.push_back(Point3d(0, 2, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
SubSurface window(points, model);
DaylightingDeviceShelf shelf(window);
EXPECT_EQ(window.handle(), shelf.subSurface().handle());
}
示例15: TEST_F
TEST_F(ModelFixture, ShadingSurface)
{
Model model;
Point3dVector points;
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
points.push_back(Point3d(1, 1, 0));
EXPECT_NO_THROW(ShadingSurface(points, model));
ShadingSurface shadingSurface(points, model);
EXPECT_FALSE(shadingSurface.shadingSurfaceGroup());
}