当前位置: 首页>>代码示例>>C++>>正文


C++ ofMatrix4x4::preMult方法代码示例

本文整理汇总了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;
}
开发者ID:roikr,项目名称:openFrameworks007,代码行数:57,代码来源:ofxFlash.cpp

示例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;
}
开发者ID:julapy,项目名称:ofxJulapyUtils,代码行数:13,代码来源:ofxJulapyUtils.cpp

示例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);
	}
}
开发者ID:arturoc,项目名称:ofxPolyline2Mesh,代码行数:44,代码来源:ofxPolyline2Mesh.cpp

示例4: transform

void ofxMesh::transform(const ofMatrix4x4 trans) {
    for (int i=0; i<getNumVertices(); i++) {
		getVertices()[i] = trans.preMult(getVertices()[i]);
    }
}
开发者ID:daitomanabe,项目名称:ofxMesh,代码行数:5,代码来源:ofxMesh.cpp


注:本文中的ofMatrix4x4::preMult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。