本文整理汇总了C++中setElement函数的典型用法代码示例。如果您正苦于以下问题:C++ setElement函数的具体用法?C++ setElement怎么用?C++ setElement使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setElement函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setEye
/// creates translation and rotation matrix according to euler angles and transition vector
void CMat44::createTRMatrix(float alpha, float beta, float gamma, float trans_x, float trans_y, float trans_z){
setEye();
CMat44 rotX,rotY,rotZ;
rotX.setEye();
rotY.setEye();
rotZ.setEye();
rotX.setElement(cos(alpha),2,2);
rotX.setElement(-sin(alpha),2,3);
rotX.setElement(sin(alpha),3,2);
rotX.setElement(cos(alpha),3,3);
rotY.setElement(cos(beta),1,1);
rotY.setElement(sin(beta),1,3);
rotY.setElement(-sin(beta),3,1);
rotY.setElement(cos(beta),3,3);
rotZ.setElement(cos(gamma),1,1);
rotZ.setElement(-sin(gamma),1,2);
rotZ.setElement(sin(gamma),2,1);
rotZ.setElement(cos(gamma),2,2);
*this=rotX*rotY*rotZ;
setElement(trans_x,1,4);
setElement(trans_y,2,4);
setElement(trans_z,3,4);
orientation[0]=alpha; orientation[1]=beta; orientation[2]=gamma;
}
开发者ID:Krzema,项目名称:HandEstimator,代码行数:33,代码来源:CMat44.cpp
示例2: switch
void Interface::random(float range)
{
switch (bufferType) {
case BT_BYTE:
unsigned charRange;
if (range >= 128) {
charRange = 127;
} else {
charRange = (unsigned) range;
}
for (unsigned i = 0; i < size; i++) {
setElement(i, 128 + (unsigned char) Random::integer(charRange));
}
break;
case BT_FLOAT:
case BT_FLOAT_SMALL:
for (unsigned i = 0; i < size; i++) {
setElement(i, Random::floatNum(range));
}
break;
case BT_BIT:
case BT_SIGN:
for (unsigned i = 0; i < size; i++) {
setElement(i, Random::positiveInteger(2));
}
break;
}
}
开发者ID:jtimon,项目名称:preann,代码行数:28,代码来源:interface.cpp
示例3: setIdentityMatrix
mat4& mat4::setScalingMatrix(const vec3& scaling)
{
setIdentityMatrix();
setElement(0, 0, scaling.x);
setElement(1, 1, scaling.y);
setElement(2, 2, scaling.z);
return *this;
}
开发者ID:NoRines,项目名称:3d_motor,代码行数:8,代码来源:mat4.cpp
示例4: assert
void Matrix::swap( int row1, int column1, int row2, int column2 ){
assert( row1 > -1 && row1 < m_nrows && column1 > -1 && column1 < m_ncols &&
row2 > -1 && row2 < m_nrows && column2 > -1 && column2 < m_ncols);
float element1 = getElement(row1, column1);
float element2 = getElement( row2, column2 );
setElement( row1, column1, element2 );
setElement( row2, column2, element1 );
}
开发者ID:juandavidcruz,项目名称:thesis-software-suite,代码行数:10,代码来源:matrix.cpp
示例5: reset
void DataArray::init() {
UINT i;
reset();
BYTE *ep = (BYTE*)getData();
const size_t n = size();
const UINT elemSize = getElementSize();
UINT maxValue;
switch(elemSize) {
case 1 : maxValue = min((UINT)n, 0xff ); break;
case 2 : maxValue = min((UINT)n, 0xffff); break;
default: maxValue = (UINT)n; break;
}
switch(m_param.m_initMethod) {
case IDC_RADIO_RANDOM:
{ switch(m_param.m_randomizationMethod) {
case FIXED_SEED : m_param.m_random.setSeed(m_param.m_seed); break;
case SAME_RANDOM_SEED : m_param.m_random.setSeed(m_param.m_randomSeed); break;
case RANDOM_SEED : m_param.m_random.randomize(); break;
}
for(i = 0; i < n; i++, ep += elemSize) {
setElement(ep, m_param.m_random.nextInt(maxValue));
}
}
break;
case IDC_RADIO_SORTED:
for(i = 0; i < n; i++, ep += elemSize) {
setElement(ep, (UINT)((i*maxValue)/n));
}
break;
case IDC_RADIO_INVERSESORTED:
for(i = 0; i < n; i++, ep += elemSize) {
setElement(ep, (UINT)((n-i)*maxValue/n));
}
break;
case IDC_RADIO_SINUS:
for(i = 0; i < n; i++, ep += elemSize) {
setElement(ep, (unsigned int)(maxValue * (0.5*(1.0+sin(M_PI*2*i / (n-1)*m_param.m_periodCount)))));
}
break;
case IDC_RADIO_FILEDATA:
for(i = 0; i < n; i++, ep += elemSize) {
setElement(ep, m_param.m_fileData[i]);
}
break;
default:
throwException(_T("DataArray::init:Unknown initmethod (=%d)"), m_param.m_initMethod);
break;
}
}
开发者ID:JesperMikkelsen,项目名称:Big-Numbers,代码行数:55,代码来源:InitData.cpp
示例6: SetZSetMember
void SetZSetMember(const Data& v)
{
if (type == KEY_ZSET_SCORE)
{
setElement(v, 0);
}
else
{
setElement(v, 1);
}
}
开发者ID:omegablitz,项目名称:ardb,代码行数:11,代码来源:codec.hpp
示例7: zero
//zero out all entries in a matrix of any size
void zero(struct matrix * m){
for (int i=0; i < m->height; i++){
for(int j=0; j < m->width; j++){
setElement(m,i,j, 0.0);
}
}
}
开发者ID:pat227,项目名称:hpc12-fp-jbb383-pat227,代码行数:8,代码来源:matrices.c
示例8: matrixMultiply
//given two matrices A & B and a blank answer matrix, fills the 3rd one with the
//product of AB. Returns 0 if not compatible; 1 otherwise.
int matrixMultiply(const struct matrix * const A, const struct matrix * const B,
struct matrix * const answer){
//ensure matrices are compatible & so is answer matrix, if latter is not, fix it
if(A->width != B-> height){
printf("\nMatrices are not multiplication-compatible; A has width %d, B has height %d.\n",
A->width, B->height);
return 0;
}
if(answer->width != B-> width || answer->height != A->height){
destroy(answer);
init(answer,A->height, B->width);
answer->width = B->width;
answer->height = A->height;
}
double temp = 0.0;
for(int i=0; i < answer->height; i++){
for(int j=0; j < answer->width; j++){
for(int k = 0; k < A->width; k++){
temp += getElement(A,i,k) * getElement(B,k,j);
}
setElement(answer,i,j,temp);
temp=0.0;
}
}
return 1;
}
开发者ID:pat227,项目名称:hpc12-fp-jbb383-pat227,代码行数:28,代码来源:matrices.c
示例9: elem
/**
* Update DOM tree element
*/
void
GEdge::updateElement()
{
#if 0
QDomElement e = elem();
int i = 0;
QDomElement new_e = graph()->createElement( "edge");
QDomNode e2 = graph()->documentElement().removeChild( e);
assert( !e2.isNull());
graph()->documentElement().appendChild( new_e);
setElement( new_e);
e = new_e;
#endif
/* Base class method call to print generic edge properties */
AuxEdge::updateElement();
QDomElement e = elem();
/** Save style that describes this edge only along with edge */
if ( isNotNullP( style()))
{
if ( 1 == style()->numItems())
{
e.removeAttribute("style");
style()->writeElement( e, false);
} else
{
e.setAttribute("style", style()->name());
}
}
}
开发者ID:ChunHungLiu,项目名称:codequery,代码行数:33,代码来源:edge_item.cpp
示例10: tan
mat4& mat4::setPerspectiveMatrix(float fov, float aspectRatio, float far, float near)
{
*this = mat4();
float ar = aspectRatio;
float thf = tan(deg_to_rad(fov / 2.0f));
float range = near - far;
setElement(0, 0, 1.0f / (ar * thf));
setElement(1, 1, 1.0f / thf);
setElement(2, 2, (-near - far) / range);
setElement(3, 2, (2.0f * near * far) / range);
setElement(2, 3, 1.0f);
return *this;
}
开发者ID:NoRines,项目名称:3d_motor,代码行数:16,代码来源:mat4.cpp
示例11: uassert
void Scope::loadStored( bool ignoreNotConnected ){
if ( _localDBName.size() == 0 ){
if ( ignoreNotConnected )
return;
uassert( "need to have locallyConnected already" , _localDBName.size() );
}
if ( _loadedVersion == _lastVersion )
return;
_loadedVersion = _lastVersion;
static DBClientBase * db = createDirectClient();
auto_ptr<DBClientCursor> c = db->query( _localDBName + ".system.js" , Query() );
while ( c->more() ){
BSONObj o = c->next();
BSONElement n = o["_id"];
BSONElement v = o["value"];
uassert( "name has to be a string" , n.type() == String );
uassert( "value has to be set" , v.type() != EOO );
setElement( n.valuestr() , v );
}
}
开发者ID:petewarden,项目名称:mongo,代码行数:26,代码来源:engine.cpp
示例12: worldPoint
void BlockPhysicsComponent::rasterize(Polygon2 const &polygon)
{
Polygon2 localPolygon;
for (int i = 0; i < polygon.getSize(); ++i) {
b2Vec2 worldPoint(polygon.vertices[i].x, polygon.vertices[i].y);
b2Vec2 localPoint = body_->GetLocalPoint(worldPoint);
localPolygon.vertices.push_back(Vector2(localPoint.x, localPoint.y));
}
Box2 bounds = localPolygon.getBoundingBox();
int minX = int(10.0f * bounds.p1.x + 0.05f);
int minY = int(10.0f * bounds.p1.y + 0.05f);
int maxX = int(10.0f * bounds.p2.x + 0.05f);
int maxY = int(10.0f * bounds.p2.y + 0.05f);
for (int y = minY; y <= maxY; ++y) {
for (int x = minX; x <= maxX; ++x) {
Vector2 localPoint(0.1f * float(x), 0.1f * float(y));
if (localPolygon.containsPoint(localPoint)) {
for (int dy = -1; dy <= 1; ++dy) {
for (int dx = -1; dx <= 1; ++dx) {
if (dx == 0 || dy == 0) {
setElement(x + dx, y + dy, 1);
}
}
}
}
}
}
}
开发者ID:elemel,项目名称:crust,代码行数:28,代码来源:block_physics_component.cpp
示例13: isScalar
bool vesUniform::set(const vesVector4f &vector)
{
if (this->m_numberElements == 0)
this->m_numberElements = 1;
return isScalar() ? setElement(0, vector) : false;
}
开发者ID:Eduardop,项目名称:VES,代码行数:7,代码来源:vesUniform.cpp
示例14: assert
// set the identity matrix of dimension n
void Matrix::setIdentityMatrix( int n )
{
assert( n > 0 );
setDimensions( n, n );
setZero();
for ( int i = 0; i < n; i++ ) setElement( i, i, 1.0 );
}
开发者ID:jacobclifford,项目名称:MIBBS,代码行数:8,代码来源:Tools.cpp
示例15: adjustCamera
void SoXipDicomExaminer::GLRender( SoGLRenderAction* action )
{
if (mViewAll)
{
SoXipDataImage* xipImage = ((SoXipSFDataImage *)mImage->getField(SbName("image")))->getValue();
if( !xipImage )
return ;
SbXipImage* image = xipImage->get();
if( image )
adjustCamera( action, image->getModelMatrix() );
// Store the information of the current displayed image
mImageModelMatrix = image->getModelMatrix();
mViewAll = FALSE;
}
if( mViewBoundingBox )
{
adjustCamera( action, boundingBox.getValue() );
mViewBoundingBox = false;
}
// Set the Dicom Element
setElement( action );
mImageSwitch->enableNotify( FALSE );
((SoSFInt32 *)mImageSwitch->getField(SbName("whichChild")))->setValue( drawImage.getValue() ? 0 : -1 );
mImageSwitch->enableNotify( TRUE );
SoXipKit::GLRender( action );
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:34,代码来源:SoXipDicomExaminer.cpp
示例16: int
void BlockPhysicsComponent::setElementAtPosition(float x, float y, int type)
{
b2Vec2 localPosition = body_->GetLocalPoint(b2Vec2(x, y));
int xIndex = int(std::floor(10.0f * localPosition.x + 0.5f));
int yIndex = int(std::floor(10.0f * localPosition.y + 0.5f));
setElement(xIndex, yIndex, type);
}
开发者ID:elemel,项目名称:crust,代码行数:7,代码来源:block_physics_component.cpp
示例17: setDimensions
// set the diagonal matrix
void Matrix::setDiagonalMatrix( const vector< double >& diag )
{
int n = diag.size();
setDimensions( n, n );
setZero();
for ( int i = 0; i < n; i++ ) setElement( i, i, diag[ i ] );
}
开发者ID:jacobclifford,项目名称:MIBBS,代码行数:9,代码来源:Tools.cpp
示例18: setElement
mat4::mat4(float diagonal)
{
for(unsigned int x = 0; x < 4; x++)
{
for(unsigned int y = 0; y < 4; y++)
{
if(x == y)
{
setElement(x, y, diagonal);
}
else
{
setElement(x, y, 0.0f);
}
}
}
}
开发者ID:NoRines,项目名称:3d_motor,代码行数:17,代码来源:mat4.cpp
示例19: setElement
void Ms::InspectorAmbitus::updateRange()
{
Ambitus* range = static_cast<Ambitus*>(inspector->element());
range->updateRange();
range->layout(); // redo layout
setElement(); // set Inspector values to range properties
valueChanged(AmbitusControl::TOPTPC); // force score to notice new range properties
}
开发者ID:HerbertYu,项目名称:MuseScore,代码行数:8,代码来源:inspectorAmbitus.cpp
示例20: metallisation
void FormMetallisation::reset()
{
FormElementBase::reset();
this->metal=new metallisation();
setElement(this->metal);
init();
}
开发者ID:BenjBoug,项目名称:INSA-Electro-Sim-Editor,代码行数:9,代码来源:FormMetallisation.cpp
注:本文中的setElement函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论