本文整理汇总了C++中coords函数的典型用法代码示例。如果您正苦于以下问题:C++ coords函数的具体用法?C++ coords怎么用?C++ coords使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了coords函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: coords
void Generator::operator ()(Chunk &chunk) const noexcept {
ExactLocation::Fine coords(chunk.Position() * ExactLocation::Extent());
coords += 0.5f;
ValueField field {
{ solidity_noise, coords, config.solidity },
{ humidity_noise, coords, config.humidity },
{ temperature_noise, coords, config.temperature },
{ richness_noise, coords, config.richness },
{ random_noise, coords, config.randomness },
};
for (int z = 0; z < Chunk::side; ++z) {
for (int y = 0; y < Chunk::side; ++y) {
for (int x = 0; x < Chunk::side; ++x) {
chunk.SetBlock(RoughLocation::Fine(x, y, z), Generate(field, RoughLocation::Fine(x, y, z)));
}
}
}
chunk.SetGenerated();
}
示例2: xml
void CoordXmlTest::writeHumanReadableString()
{
namespace literal = XmlStreamLiteral;
buffer.open(QBuffer::ReadWrite);
QXmlStreamWriter xml(&buffer);
xml.setAutoFormatting(false);
xml.writeStartDocument();
QFETCH(int, num_coords);
MapCoordVector coords(num_coords, proto_coord);
QBENCHMARK
{
writeHumanReadableString_implementation(coords, xml);
}
xml.writeEndDocument();
buffer.close();
}
示例3: coords
void map_t::way_cut_highlight(map_item_t *item, lpos_t pos) {
if(item_is_selected_way(item)) {
int seg = canvas->get_item_segment(item->item, pos);
if(seg >= 0) {
unsigned int width = (item->object.way->draw.flags & OSM_DRAW_FLAG_BG) ?
2 * item->object.way->draw.bg.width :
3 * item->object.way->draw.width;
std::vector<lpos_t> coords(2);
coords[0] = item->object.way->node_chain[seg]->lpos;
coords[1] = item->object.way->node_chain[seg + 1]->lpos;
cursor = canvas->polyline_new(CANVAS_GROUP_DRAW, coords, width, style->highlight.node_color);
}
} else if(item_is_selected_node(item)) {
/* cutting a way at its first or last node doesn't make much sense ... */
if(!selected.object.way->ends_with_node(item->object.node))
hl_cursor_draw(item->object.node->lpos, 2 * style->node.radius);
}
}
示例4: coords
int Hive::canMove(int position, Direction direction)
{
QPair<int, int> coords(move(toMap(position), direction));
if (coords.first < 0 || coords.first >= m_size
|| coords.second < 0 || coords.second >= m_size)
{
return position;
}
int newPosition(fromMap(coords));
QMutexLocker locker(&m_mutex);
if (isCapacityExceed(newPosition))
{
return position;
} else
{
return newPosition;
}
}
示例5: coords
nsIntPoint
nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode)
{
nsIntPoint coords(0, 0);
nsCOMPtr<nsIDocShellTreeItem> treeItem(GetDocShellFor(aNode));
if (!treeItem)
return coords;
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
treeItem->GetTreeOwner(getter_AddRefs(treeOwner));
if (!treeOwner)
return coords;
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(treeOwner);
if (baseWindow)
baseWindow->GetPosition(&coords.x, &coords.y); // in device pixels
return coords;
}
示例6: coords
// Check that the current state of the board is valid
bool Board::BoardValid()
{
int solvedValue;
for (int y=0; y<Common::NoNumbers; y++)
{
for(int x=0; x<Common::NoNumbers; x++)
{
Coords coords(x, y);
solvedValue = _theSquares[x][y]->SolvedValue();
if(solvedValue && !IsSquareValid(coords, solvedValue))
{
return false;
}
}
}
return true;
}
示例7: xml
void CoordXmlTest::writeFastImplementation()
{
buffer.open(QBuffer::ReadWrite);
QXmlStreamWriter xml(&buffer);
xml.setAutoFormatting(false);
xml.writeStartDocument();
XMLFileFormat::active_version = 6; // Activate fast text format.
XmlElementWriter element(xml, QLatin1String("root"));
QFETCH(int, num_coords);
MapCoordVector coords(num_coords, proto_coord);
QBENCHMARK
{
element.write(coords);
}
xml.writeEndDocument();
buffer.close();
}
示例8: wxCHECK_MSG
wxString wxSheetValueProviderSparseStringTest::GetValue( const wxSheetCoords& coords_ ) const
{
wxCHECK_MSG(ContainsCell(coords_), wxEmptyString, wxT("Invalid coords"));
wxSheetCoords coords(HasOption(wxSHEET_ValueProviderColPref) ? coords_ : coords_.GetSwapped());
((wxSheetValueProviderSparseStringTest*)this)->m_intArrayIntString.m_key = coords.m_row;
const int rowPos = m_data.Index((wxSheetIntArrayIntString*)&m_intArrayIntString);
// const int rowPos = m_data.Index(wxSheetIntArrayIntString(coords.m_row));
if (rowPos != wxNOT_FOUND)
{
((wxSheetValueProviderSparseStringTest*)this)->m_intString.m_key = coords.m_col;
const int colPos = m_data[rowPos].m_value->Index((wxSheetIntString*)&m_intString);
//const int colPos = m_data[rowPos].m_value.Index(wxSheetIntString(coords.m_col));
if (colPos != wxNOT_FOUND)
return m_data[rowPos].m_value->Item(colPos).m_value;
}
return wxEmptyString;
}
示例9: coords
void Mesquite::PlanarDomain::fit_vertices( Mesquite::Mesh* mesh,
const Mesquite::Mesh::VertexHandle* verts,
size_t num_verts,
Mesquite::MsqError& err,
double epsilon )
{
std::vector<MsqVertex> coords( num_verts );
mesh->vertices_get_coordinates( verts, arrptr(coords), num_verts, err );
MSQ_ERRRTN(err);
if (epsilon <= 0.0)
epsilon = DomainUtil::default_tolerance( arrptr(coords), num_verts );
Vector3D pts[3];
if (!DomainUtil::non_colinear_vertices( arrptr(coords), num_verts, pts, epsilon )) {
MSQ_SETERR(err)("All vertices are colinear", MsqError::INVALID_MESH);
return;
}
this->set_plane( (pts[1] - pts[0]) * (pts[2] - pts[0]), pts[0] );
}
示例10: TextureToolControl
RegionTextureControl::RegionTextureControl(MyGUI::Widget* _parent) :
TextureToolControl(_parent),
mTextureVisible(false),
mAreaSelectorControl(nullptr),
mPositionSelectorControl(nullptr)
{
mTypeName = MyGUI::utility::toString((size_t)this);
// immediately draw a frames for states
std::vector<MyGUI::IntCoord> coords(10);
drawUnselectedStates(coords);
addSelectorControl(mAreaSelectorControl);
addSelectorControl(mPositionSelectorControl);
mPositionSelectorControl->setEnabled(false);
mAreaSelectorControl->eventChangePosition += MyGUI::newDelegate(this, &RegionTextureControl::notifyChangePosition);
CommandManager::getInstance().registerCommand("Command_MoveLeft", MyGUI::newDelegate(this, &RegionTextureControl::CommandMoveLeft));
CommandManager::getInstance().registerCommand("Command_MoveRight", MyGUI::newDelegate(this, &RegionTextureControl::CommandMoveRight));
CommandManager::getInstance().registerCommand("Command_MoveTop", MyGUI::newDelegate(this, &RegionTextureControl::CommandMoveTop));
CommandManager::getInstance().registerCommand("Command_MoveBottom", MyGUI::newDelegate(this, &RegionTextureControl::CommandMoveBottom));
CommandManager::getInstance().registerCommand("Command_SizeLeft", MyGUI::newDelegate(this, &RegionTextureControl::CommandSizeLeft));
CommandManager::getInstance().registerCommand("Command_SizeRight", MyGUI::newDelegate(this, &RegionTextureControl::CommandSizeRight));
CommandManager::getInstance().registerCommand("Command_SizeTop", MyGUI::newDelegate(this, &RegionTextureControl::CommandSizeTop));
CommandManager::getInstance().registerCommand("Command_SizeBottom", MyGUI::newDelegate(this, &RegionTextureControl::CommandSizeBottom));
CommandManager::getInstance().registerCommand("Command_GridMoveLeft", MyGUI::newDelegate(this, &RegionTextureControl::CommandGridMoveLeft));
CommandManager::getInstance().registerCommand("Command_GridMoveRight", MyGUI::newDelegate(this, &RegionTextureControl::CommandGridMoveRight));
CommandManager::getInstance().registerCommand("Command_GridMoveTop", MyGUI::newDelegate(this, &RegionTextureControl::CommandGridMoveTop));
CommandManager::getInstance().registerCommand("Command_GridMoveBottom", MyGUI::newDelegate(this, &RegionTextureControl::CommandGridMoveBottom));
CommandManager::getInstance().registerCommand("Command_GridSizeLeft", MyGUI::newDelegate(this, &RegionTextureControl::CommandGridSizeLeft));
CommandManager::getInstance().registerCommand("Command_GridSizeRight", MyGUI::newDelegate(this, &RegionTextureControl::CommandGridSizeRight));
CommandManager::getInstance().registerCommand("Command_GridSizeTop", MyGUI::newDelegate(this, &RegionTextureControl::CommandGridSizeTop));
CommandManager::getInstance().registerCommand("Command_GridSizeBottom", MyGUI::newDelegate(this, &RegionTextureControl::CommandGridSizeBottom));
initialiseAdvisor();
updateCaption();
}
示例11: coords
void
CustomMeshFactory::buildElements(STK_Interface &mesh) const
{
mesh.beginModification();
const int dim = mesh.getDimension();
// build the nodes
std::vector<double> coords(dim,0.0);
for (int i=0;i<NumNodesPerProc_;++i) {
for (int k=0;k<dim;++k)
coords[k] = Coords_[i*dim+k];
mesh.addNode(Nodes_[i], coords);
}
// build the elements
std::vector<std::string> block_ids;
mesh.getElementBlockNames(block_ids);
for (int i=0;i<NumElementsPerProc_;++i) {
// get block by its name
std::stringstream block_id;
block_id << "eblock-" << BlockIDs_[i];
stk_classic::mesh::Part *block = mesh.getElementBlockPart(block_id.str());
// construct element and its nodal connectivity
stk_classic::mesh::EntityId elt = i + OffsetToGlobalElementIDs_;
std::vector<stk_classic::mesh::EntityId> elt2nodes(8);
for (int k=0;k<8;++k)
elt2nodes[k] = Element2Nodes_[i*8+k];
RCP<ElementDescriptor> ed = rcp(new ElementDescriptor(elt,elt2nodes));
mesh.addElement(ed,block);
}
mesh.endModification();
}
示例12: process
void process ()
{
// generate point set
std::vector<typename K::Point_d> points;
points.reserve( 100);
{
int d = 10;
std::vector<double> coords( d+1);
int i, j;
double hom = 2.0;
for ( i = 0; i < 100; ++i) {
for (j=0; j<d; ++j)
coords[ j] = CGAL::default_random( 0x100000);
coords[d] = hom;
points.push_back
(typename K::Point_d(d, coords.begin(), coords.end()));
}
// call test function
CGAL::test_Min_annulus_d(points.begin(), points.end(), Traits(), 0);
}
}
示例13: qmlInfo
void Geocode::search(double longitude, double latitude) {
if (!isActive()) {
qmlInfo(this) << "geocoding is not active";
return;
}
if (!m_service->isInitialized()) {
m_pending = QGeoCoordinate(latitude, longitude);
return;
}
m_id = 0;
QGeoCoordinate coords(latitude, longitude);
GeoLocationService::GeoLocationError err = m_service->addressQuery(coords, 1, &m_id);
if (err == GeoLocationService::QueryFailedError) {
setActive(false);
}
if (err != GeoLocationService::NoError) {
qmlInfo(this) << "error" << err << "from GeoLocationService";
}
}
示例14: coords
IDRangeList
GCells::getParticleNeighbours(const magnet::math::MortonNumber<3>& particle_cell_coords) const
{
if (verbose)
{
derr
<< "Getting neighbours of cell " << particle_cell_coords.toString()
<< std::endl;
}
magnet::math::MortonNumber<3> zero_coords;
for (size_t iDim(0); iDim < NDIM; ++iDim)
zero_coords[iDim] = (particle_cell_coords[iDim].getRealValue() + cellCount[iDim] - overlink)
% cellCount[iDim];
IDRangeList retval;
//This initial reserve greatly speeds up the later inserts
retval.getContainer().reserve(32);
magnet::math::MortonNumber<3> coords(zero_coords);
for (size_t x(0); x < 2 * overlink + 1; ++x)
{
coords[0] = (zero_coords[0].getRealValue() + x) % cellCount[0];
for (size_t y(0); y < 2 * overlink + 1; ++y)
{
coords[1] = (zero_coords[1].getRealValue() + y) % cellCount[1];
for (size_t z(0); z < 2 * overlink + 1; ++z)
{
coords[2] = (zero_coords[2].getRealValue() + z) % cellCount[2];
const std::vector<size_t>& nlist = list[coords.getMortonNum()];
retval.getContainer().insert(retval.getContainer().end(), nlist.begin(), nlist.end());
}
}
}
return retval;
}
示例15: coords
nsIntPoint
nsCoreUtils::GetScreenCoordsForWindow(nsINode *aNode)
{
nsIntPoint coords(0, 0);
nsCOMPtr<nsIDocShellTreeItem> treeItem(GetDocShellTreeItemFor(aNode));
if (!treeItem)
return coords;
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
nsCOMPtr<nsIDOMDocument> domDoc = do_GetInterface(rootTreeItem);
if (!domDoc)
return coords;
nsCOMPtr<nsIDOMWindow> window;
domDoc->GetDefaultView(getter_AddRefs(window));
if (!window)
return coords;
window->GetScreenX(&coords.x);
window->GetScreenY(&coords.y);
return coords;
}