本文整理汇总了C++中ofMatrix4x4::preMult方法的典型用法代码示例。如果您正苦于以下问题:C++ ofMatrix4x4::preMult方法的具体用法?C++ ofMatrix4x4::preMult怎么用?C++ ofMatrix4x4::preMult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofMatrix4x4
的用法示例。
在下文中一共展示了ofMatrix4x4::preMult方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getBoundingBox
ofRectangle ofxSymbolInstance::getBoundingBox(ofMatrix4x4 mat) {
// cout << "bounding box" << endl;
ofRectangle rect(0,0,0,0);
mat.preMult(this->mat);
switch (type) {
case BITMAP_INSTANCE: {
ofVec2f p0 = mat.preMult(ofVec3f(0,0,0));
ofVec2f p1 = mat.preMult(ofVec3f(bitmapItem->getWidth(),bitmapItem->getHeight()));
rect = ofRectangle(p0.x,p0.y,p1.x-p0.x,p1.y-p0.y);
} break;
case SYMBOL_INSTANCE: {
for (vector<layer>::iterator liter=layers.begin();liter!=layers.end();liter++) {
frame &f = liter->frames[liter->currentFrame];
vector<ofxSymbolInstance>::iterator iter=f.instances.begin();
while (iter!=f.instances.end()) {
rect = iter->getBoundingBox(mat);
iter++;
if (rect.width!=0 || rect.height!=0) {
break;
}
}
while (iter!=f.instances.end()) {
ofRectangle iterect = iter->getBoundingBox();
if (iterect.width!=0 || iterect.height!=0) {
ofVec2f p0(rect.x,rect.y);
ofVec2f p1(p0.x+rect.width,p0.y+rect.height);
ofVec2f q0(iterect.x,iterect.y);
ofVec2f q1(q0.x+iterect.width,q0.y+iterect.height);
ofVec2f pos(MIN(p0.x,q0.x),MIN(p0.y,q0.y));
rect = ofRectangle(pos.x,pos.y,MAX(p1.x,q1.x)-pos.x,MAX(p1.y,q1.y)-pos.y);
// cout << rect.x << "\t" << rect.y << "\t" << rect.width << "\t" << rect.height << endl;
}
iter++;
}
}
} break;
default:
break;
}
return rect;
}
示例2: ofRectangleTransform
ofRectangle ofRectangleTransform(const ofRectangle & rect, const ofMatrix4x4 & mat) {
ofVec3f tl = rect.getTopLeft();
ofVec3f br = rect.getBottomRight();
tl = mat.preMult(tl);
br = mat.preMult(br);
ofRectangle r;
r.setPosition(tl);
r.growToInclude(br);
return r;
}
示例3:
void ofxPolyline2Mesh::pushSegment(const ofColor& c2, const ofColor& c1,
const ofMatrix4x4 &m)
{
for (int i = 0; i < shape.size(); i++)
{
const ofVec3f &p = m.preMult(shape[i]);
current_segments[i] = p;
}
for (int i = 0; i < shape.size() - 1; i++)
{
const ofVec3f &p1 = last_segments[i];
const ofVec3f &p2 = current_segments[i];
const ofVec3f &n1 = last_segments[i + 1];
const ofVec3f &n2 = current_segments[i + 1];
const ofVec3f norm = (p2 - p1).crossed((n1 - p1)).normalized();
mesh.addNormal(norm);
mesh.addColor(c1);
mesh.addVertex(p1);
mesh.addNormal(norm);
mesh.addColor(c2);
mesh.addVertex(p2);
mesh.addNormal(norm);
mesh.addColor(c1);
mesh.addVertex(n1);
mesh.addNormal(norm);
mesh.addColor(c1);
mesh.addVertex(n1);
mesh.addNormal(norm);
mesh.addColor(c2);
mesh.addVertex(p2);
mesh.addNormal(norm);
mesh.addColor(c2);
mesh.addVertex(n2);
}
}
示例4: transform
void ofxMesh::transform(const ofMatrix4x4 trans) {
for (int i=0; i<getNumVertices(); i++) {
getVertices()[i] = trans.preMult(getVertices()[i]);
}
}