本文整理汇总了C++中coords函数的典型用法代码示例。如果您正苦于以下问题:C++ coords函数的具体用法?C++ coords怎么用?C++ coords使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了coords函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:HolySmoke86,项目名称:blank,代码行数:19,代码来源:Generator.cpp
示例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();
}
开发者ID:aivarszo,项目名称:mapper,代码行数:19,代码来源:coord_xml_t.cpp
示例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);
}
}
开发者ID:AMDmi3,项目名称:osm2go,代码行数:19,代码来源:map_edit.cpp
示例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;
}
}
开发者ID:enree,项目名称:flyZ,代码行数:19,代码来源:Hive.cpp
示例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;
}
开发者ID:mhoye,项目名称:mozilla-central,代码行数:19,代码来源:nsCoreUtils.cpp
示例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;
}
开发者ID:fkp,项目名称:src,代码行数:21,代码来源:board.cpp
示例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();
}
开发者ID:999999333,项目名称:mapper,代码行数:20,代码来源:coord_xml_t.cpp
示例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;
}
开发者ID:GWRon,项目名称:wx.mod,代码行数:20,代码来源:sheetval.cpp
示例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] );
}
开发者ID:bartlettroscoe,项目名称:trilinos_old_public,代码行数:21,代码来源:Mesquite_PlanarDomain.cpp
示例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();
}
开发者ID:digiant,项目名称:myway3d,代码行数:40,代码来源:RegionTextureControl.cpp
示例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();
}
开发者ID:Russell-Jones-OxPhys,项目名称:Trilinos,代码行数:40,代码来源:Panzer_STK_CustomMeshFactory.cpp
示例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);
}
}
开发者ID:Fox-Heracles,项目名称:cgal,代码行数:22,代码来源:test_Min_annulus_d_d.cpp
示例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";
}
}
开发者ID:ballock,项目名称:cameraplus,代码行数:22,代码来源:geocode.cpp
示例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;
}
开发者ID:subratv,项目名称:DynamO,代码行数:38,代码来源:cells.cpp
示例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;
}
开发者ID:ehsan,项目名称:mozilla-central-cdouble,代码行数:23,代码来源:nsCoreUtils.cpp
示例16: coords
m::plane kdNode::findSplittingPlane(const kdTree *tree, const u::vector<int> &tris, m::axis axis) const {
const size_t triangleCount = tris.size();
// every vertex component is stored depending on `axis' axis in the following
// vector. The vector gets sorted and the median is chosen as the splitting
// plane.
u::vector<float> coords(triangleCount * 3); // 3 vertices for a triangle
size_t k = 0;
for (size_t i = 0; i < triangleCount; i++) {
for (size_t j = 0; j < 3; j++) {
const int index = tree->m_triangles[tris[i]].m_vertices[j];
const m::vec3 &vec = tree->m_vertices[index];
coords[k++] = vec[axis];
}
}
// sort coordinates for a L1 median estimation, this keeps us rather
// robust against vertex outliers.
u::sort(coords.begin(), coords.end(), [](float a, float b) { return a < b; });
const float split = coords[coords.size() / 2]; // median like
const m::vec3 point(m::vec3::getAxis(axis) * split);
const m::vec3 normal(m::vec3::getAxis(axis));
return m::plane(point, normal);
}
开发者ID:dreamsxin,项目名称:neothyne,代码行数:24,代码来源:kdtree.cpp
示例17: coords
/// Ist es an dieser Stelle für einen Spieler möglich einen Hafen zu bauen
bool GameWorldBase::IsHarborPointFree(const unsigned harbor_id, const unsigned char player, const unsigned short sea_id) const
{
Point<MapCoord> coords(GetHarborPoint(harbor_id));
// Befindet sich der Hafenpunkt auch an dem erforderlichen Meer?
bool at_sea = false;
for(unsigned i = 0;i<6;++i)
{
if(harbor_pos[harbor_id].cps[i].sea_id == sea_id)
{
at_sea = true;
break;
}
}
if(!at_sea)
return false;
// Überprüfen, ob das Gebiet in einem bestimmten Radius entweder vom Spieler oder gar nicht besetzt ist
for(MapCoord tx=GetXA(coords.x,coords.y,0), r=1;r<=4;tx=GetXA(tx,coords.y,0),++r)
{
MapCoord tx2 = tx, ty2 = coords.y;
for(unsigned i = 2;i<8;++i)
{
for(MapCoord r2=0;r2<r;GetPointA(tx2,ty2,i%6),++r2)
{
unsigned char owner = GetNode(tx2,ty2).owner;
if(owner != 0 && owner != player+1)
return false;
}
}
}
return (CalcBQ(coords.x,coords.y,0,false,false,true) == BQ_HARBOR);
}
开发者ID:MiyaxinPittahai,项目名称:s25rttr,代码行数:37,代码来源:GameWorldBase.cpp
示例18: coords
double OBEnergyConformerScore::Score(OBMol &mol, unsigned int index,
const RotorKeys &keys, const std::vector<double*> &conformers)
{
double *origCoords = mol.GetCoordinates();
// copy the original coordinates to coords
// copy the conformer coordinates to OBMol object
std::vector<double> coords(mol.NumAtoms() * 3);
for (unsigned int i = 0; i < mol.NumAtoms() * 3; ++i) {
coords[i] = origCoords[i];
origCoords[i] = conformers[index][i];
}
OBForceField *ff = OBForceField::FindType("MMFF94");
if (!ff->Setup(mol))
return 10e10;
// ff->SteepestDescent(500);
double score = ff->Energy();
// copy original coordinates back
for (unsigned int i = 0; i < mol.NumAtoms() * 3; ++i)
origCoords[i] = coords[i];
return score;
}
开发者ID:baoilleach,项目名称:openbabel-svn-mirror,代码行数:24,代码来源:conformersearch.cpp
示例19: get_mesh
void TagVertexMesh::vertices_get_coordinates( const VertexHandle vert_array[],
MsqVertex* coordinates,
size_t num_vtx,
MsqError &err )
{
if (!num_vtx)
return;
if (!haveTagHandle) {
get_mesh()->vertices_get_coordinates( vert_array, coordinates, num_vtx, err );
MSQ_ERRRTN(err);
}
else {
std::vector<double> coords( num_vtx * 3 );
get_mesh()->tag_get_vertex_data( tagHandle, num_vtx, vert_array, arrptr(coords), err );
MSQ_ERRRTN(err);
MsqVertex* coordinates_end = coordinates + num_vtx;
std::vector<double>::const_iterator i = coords.begin();
while (coordinates != coordinates_end) {
coordinates->set( &*i );
i += 3;
++coordinates;
}
}
}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:24,代码来源:TagVertexMesh.cpp
示例20: get_space
texture_atlas::coords texture_atlas::add(const unsigned int width, const unsigned int height, const void *data, const unsigned int type)
{
icoords space = get_space(width, height);
vector<irec> newspace;
for (size_t r = 0; r < open_space_[space.id].size(); r++)
{
vector<irec> subrec = open_space_[space.id][r].sub(space.area);
newspace.insert(newspace.end(), subrec.begin(), subrec.end());
}
open_space_[space.id] = newspace;
GLenum test = glGetError();
glBindTexture(GL_TEXTURE_2D, ids_[space.id]);
test = glGetError();
glTexSubImage2D(GL_TEXTURE_2D, 0, space.area.left(), space.area.top(), space.area.width(), space.area.height(), GL_RGBA, type, data);
test = glGetError();
return coords(space.id,
rec(space.area.left() / static_cast<float>(width_),
space.area.top() / static_cast<float>(height_),
space.area.width() / static_cast<float>(width_),
space.area.height() / static_cast<float>(height_)));
}
开发者ID:IcyDefiance,项目名称:nIceFramework,代码行数:24,代码来源:Texture.cpp
注:本文中的coords函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论