本文整理汇总了C++中MapLine::v2方法的典型用法代码示例。如果您正苦于以下问题:C++ MapLine::v2方法的具体用法?C++ MapLine::v2怎么用?C++ MapLine::v2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapLine
的用法示例。
在下文中一共展示了MapLine::v2方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openSector
void PolygonSplitter::openSector(MapSector* sector)
{
// Check sector was given
if (!sector)
return;
// Init
clear();
// Get list of sides connected to this sector
vector<MapSide*>& sides = sector->connectedSides();
// Go through sides
MapLine* line;
for (unsigned a = 0; a < sides.size(); a++)
{
line = sides[a]->getParentLine();
// Ignore this side if its parent line has the same sector on both sides
if (!line || line->doubleSector())
continue;
// Add the edge to the splitter (direction depends on what side of the line this is)
if (line->s1() == sides[a])
addEdge(line->v1()->xPos(), line->v1()->yPos(), line->v2()->xPos(), line->v2()->yPos());
else
addEdge(line->v2()->xPos(), line->v2()->yPos(), line->v1()->xPos(), line->v1()->yPos());
}
}
示例2: updateBBox
/* MapSector::updateBBox
* Calculates the sector's bounding box
*******************************************************************/
void MapSector::updateBBox()
{
// Reset bounding box
bbox.reset();
for (unsigned a = 0; a < connected_sides.size(); a++)
{
MapLine* line = connected_sides[a]->getParentLine();
if (!line) continue;
bbox.extend(line->v1()->xPos(), line->v1()->yPos());
bbox.extend(line->v2()->xPos(), line->v2()->yPos());
}
text_point.set(0, 0);
setGeometryUpdated();
}
示例3: getVertices
/* MapSector::getVertices
* Adds all vertices that are part of the sector to [list]
*******************************************************************/
bool MapSector::getVertices(vector<MapObject*>& list)
{
// Go through connected sides
MapLine* line;
for (unsigned a = 0; a < connected_sides.size(); a++)
{
line = connected_sides[a]->getParentLine();
// Add the side's parent line's vertices to the list if they doesn't already exist
if (line->v1() && std::find(list.begin(), list.end(), line->v1()) == list.end())
list.push_back(line->v1());
if (line->v2() && std::find(list.begin(), list.end(), line->v2()) == list.end())
list.push_back(line->v2());
}
return true;
}
示例4: if
//.........这里部分代码省略.........
{
// Scale
double xscale, yscale;
if (item_type == MapEditor::SEL_SIDE_BOTTOM)
{
xscale = side->floatProperty("scalex_bottom");
yscale = side->floatProperty("scaley_bottom");
}
else if (item_type == MapEditor::SEL_SIDE_MIDDLE)
{
xscale = side->floatProperty("scalex_mid");
yscale = side->floatProperty("scaley_mid");
}
else
{
xscale = side->floatProperty("scalex_top");
yscale = side->floatProperty("scaley_top");
}
info2.push_back(S_FMT("Scale: %1.2fx, %1.2fx", xscale, yscale));
}
else
{
info2.push_back("");
}
// Height of this section of the wall
// TODO this is wrong in the case of slopes, but slope support only
// exists in the 3.1.1 branch
fpoint2_t left_point, right_point;
MapSide* other_side;
if (side == line->s1())
{
left_point = line->v1()->getPoint(0);
right_point = line->v2()->getPoint(0);
other_side = line->s2();
}
else
{
left_point = line->v2()->getPoint(0);
right_point = line->v1()->getPoint(0);
other_side = line->s1();
}
MapSector* this_sector = side->getSector();
MapSector* other_sector = NULL;
if (other_side)
other_sector = other_side->getSector();
double left_height, right_height;
if (item_type == MapEditor::SEL_SIDE_MIDDLE && other_sector)
{
// A two-sided line's middle area is the smallest distance between
// both sides' floors and ceilings, which is more complicated with
// slopes.
plane_t floor1 = this_sector->getFloorPlane();
plane_t floor2 = other_sector->getFloorPlane();
plane_t ceiling1 = this_sector->getCeilingPlane();
plane_t ceiling2 = other_sector->getCeilingPlane();
left_height = min(ceiling1.height_at(left_point), ceiling2.height_at(left_point))
- max(floor1.height_at(left_point), floor2.height_at(left_point));
right_height = min(ceiling1.height_at(right_point), ceiling2.height_at(right_point))
- max(floor1.height_at(right_point), floor2.height_at(right_point));
}
else
{
plane_t top_plane, bottom_plane;