• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TriMesh类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TriMesh的典型用法代码示例。如果您正苦于以下问题:C++ TriMesh类的具体用法?C++ TriMesh怎么用?C++ TriMesh使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TriMesh类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: moveSubmodel

/// \param nSubmodel Specifies the index of the submodel.
/// \param v Specifies the vector of displacement.
void ArticulatedModel::moveSubmodel(int nSubmodel,const Vector3 &v){ //move origin of submodel
  if (nSubmodel >= m_nSubmodelCount) return; // bail out if bad index

  //EditTriMesh editMesh;
  for(int i = 0; i < m_nNextSubmodelPart[nSubmodel]; i++ )
  {

    TriMesh	*t = &m_partMeshList[m_nSubmodelPart[nSubmodel][i]];
    //t->toEditMesh(editMesh);
    t->moveVertices(v);

    if(m_vertexBuffer == NULL)
      continue;

    int partID = m_nSubmodelPart[nSubmodel][i];
    int offset = m_vertexOffsets[partID];

    m_vertexBuffer->lock();

    for(int i=0; i < t->getVertexCount(); i++)
    {
      (*m_vertexBuffer)[offset+i].p = t->getVertexList()[i].p;
    }

    m_vertexBuffer->unlock();
  }
}
开发者ID:kmh0237,项目名称:GameProgramming2Project,代码行数:29,代码来源:ArticulatedModel.cpp


示例2: CreateGetHelpNode

//----------------------------------------------------------------------------
void TriggerActor::SetAreaType(AreaType type)
{
	mAreaType = type;

	CreateGetHelpNode()->DetachChild(mAreaMovable);

	VertexFormat *vf = PX2_GR.GetVertexFormat(GraphicsRoot::VFT_PC);
	if (AT_SPHERE == mAreaType)
	{
		StandardMesh stdMesh(vf);
		stdMesh.SetVertexColor(Float4(1.0f, 1.0f, 0.0f, 1.0f));
		TriMesh *mesh = stdMesh.Sphere(16, 16, 1.0f);
		VertexColor4MaterialPtr mtl = new0 VertexColor4Material();
		mtl->GetWireProperty(0, 0)->Enabled = true;
		mtl->GetCullProperty(0, 0)->Enabled = false;
		mesh->LocalTransform.SetUniformScale(0.5f);
		mesh->SetMaterialInstance(mtl->CreateInstance());
		mAreaMovable = mesh;
	}
	else if (AT_BOX == mAreaType)
	{
		StandardMesh stdMesh(vf);
		stdMesh.SetVertexColor(Float4(1.0f, 1.0f, 0.0f, 1.0f));
		TriMesh *mesh = stdMesh.Box(1, 1, 1);
		VertexColor4MaterialPtr mtl = new0 VertexColor4Material();
		mtl->GetWireProperty(0, 0)->Enabled = true;
		mtl->GetCullProperty(0, 0)->Enabled = false;
		mesh->LocalTransform.SetUniformScale(0.5f);
		mesh->SetMaterialInstance(mtl->CreateInstance());
		mAreaMovable = mesh;
	}

	CreateGetHelpNode()->AttachChild(mAreaMovable);
}
开发者ID:JamShan,项目名称:Phoenix3D_2.1,代码行数:35,代码来源:PX2TriggerActor.cpp


示例3: Response

//----------------------------------------------------------------------------
void CollisionsBoundTree::Response (CRecord& record0, int t0,
    CRecord& record1, int t1, Intersector<float,Vector3f>*)
{
    CollisionsBoundTree* app = (CollisionsBoundTree*)TheApplication;

    // Mesh0 triangles that are intersecting change from blue to cyan.
    TriMesh* mesh = record0.GetMesh();
    VertexBufferAccessor vba(mesh);
    const int* indices = (int*)mesh->GetIndexBuffer()->GetData();
    int i0 = indices[3*t0];
    int i1 = indices[3*t0 + 1];
    int i2 = indices[3*t0 + 2];
    vba.TCoord<Float2>(0, i0) = app->mCyanUV;
    vba.TCoord<Float2>(0, i1) = app->mCyanUV;
    vba.TCoord<Float2>(0, i2) = app->mCyanUV;
    app->mRenderer->Update(mesh->GetVertexBuffer());

    // Mesh1 triangles that are intersecting change from red to yellow.
    mesh = record1.GetMesh();
    vba.ApplyTo(mesh);
    indices = (int*)mesh->GetIndexBuffer()->GetData();
    i0 = indices[3*t1];
    i1 = indices[3*t1 + 1];
    i2 = indices[3*t1 + 2];
    vba.TCoord<Float2>(0 ,i0) = app->mYellowUV;
    vba.TCoord<Float2>(0, i1) = app->mYellowUV;
    vba.TCoord<Float2>(0, i2) = app->mYellowUV;
    app->mRenderer->Update(mesh->GetVertexBuffer());

    // NOTE: See the comments in Wm5CollisionGroup.h about information that
    // is available from the Intersector<float,Vector3f> object.
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:33,代码来源:CollisionsBoundTree.cpp


示例4: VertexBuffer

//----------------------------------------------------------------------------
TriMesh* PolyhedronDistance::CreatePlane ()
{
    VertexFormat* vformat = VertexFormat::Create(2,
        VertexFormat::AU_POSITION, VertexFormat::AT_FLOAT3, 0,
        VertexFormat::AU_COLOR, VertexFormat::AT_FLOAT3, 0);
    int vstride = vformat->GetStride();

    VertexBuffer* vbuffer = new0 VertexBuffer(4, vstride);
    VertexBufferAccessor vba(vformat, vbuffer);

    float size = 16.0f;
    vba.Position<Float3>(0) = Float3(-size, -size, -0.1f);
    vba.Position<Float3>(1) = Float3(+size, -size, -0.1f);
    vba.Position<Float3>(2) = Float3(+size, +size, -0.1f);
    vba.Position<Float3>(3) = Float3(-size, +size, -0.1f);
    vba.Color<Float3>(0, 0) = Float3(0.0f, 0.50f, 0.00f);
    vba.Color<Float3>(0, 1) = Float3(0.0f, 0.25f, 0.00f);
    vba.Color<Float3>(0, 2) = Float3(0.0f, 0.75f, 0.00f);
    vba.Color<Float3>(0, 3) = Float3(0.0f, 1.00f, 0.00f);

    IndexBuffer* ibuffer = new0 IndexBuffer(6, sizeof(int));
    int* indices = (int*)ibuffer->GetData();
    indices[0] = 0; indices[1] = 1; indices[2] = 2;
    indices[3] = 0; indices[4] = 2; indices[5] = 3;

    TriMesh* mesh = new0 TriMesh(vformat, vbuffer, ibuffer);
    mesh->SetEffectInstance(VertexColor3Effect::CreateUniqueInstance());

    return mesh;
}
开发者ID:rasslingcats,项目名称:calico,代码行数:31,代码来源:PolyhedronDistance.cpp


示例5: QString

void MeshDenoisingViaL0Minimization::initParameters()
{
    parameter_set_->removeAllParameter();

    parameter_set_->addParameter(QString("mu_beta"), 1.414, QString("mu_beta"), QString("Update ratio for beta."),
                                 true, 1.001, 10000.0);
    parameter_set_->addParameter(QString("beta"), 0.001, QString("beta"), QString("Initial beta value in optimization."),
                                 true, 1.0e-9, 10000.0);
    parameter_set_->addParameter(QString("beta_max"), 1000.0, QString("beta_max"), QString("Max beta value in optimization."),
                                 true, 10.0, 1.0e9);
    parameter_set_->addParameter(QString("mu_alpha"), 0.5, QString("mu_alpha"), QString("Update ratio for alpha."),
                                 true, 1.0e-9, 0.9999);

    TriMesh mesh = data_manager_->getNoisyMesh();
    if(mesh.n_vertices() == 0)
    {
        parameter_set_->addParameter(QString("alpha"), 0.0001, QString("alpha"), QString("Initial alpha value in optimization."),
                                     true, 0.0, 1.0e9);
        parameter_set_->addParameter(QString("lambda"), 0.0001, QString("lambda"), QString("Lambda value in optimization."),
                                     true, 1.0e-9, 1.0e9);
    }
    else
    {
        double mean_edge_length = getAverageEdgeLength(mesh);
        double mean_dihedral_angle = getAverageDihedralAngle(mesh);
        parameter_set_->addParameter(QString("alpha"), 0.1 * mean_dihedral_angle, QString("alpha"), QString("Initial alpha value in optimization."),
                                     true, 0.0, 1.0e9);
        parameter_set_->addParameter(QString("lambda"), 0.2 * mean_edge_length * mean_edge_length * mean_dihedral_angle, QString("lambda"), QString("Lambda value in optimization."),
                                     true, 1.0e-9, 1.0e9);
    }

    parameter_set_->setName(QString("Mesh Denoising via L0 Minimization"));
    parameter_set_->setLabel(QString("Mesh Denoising via L0 Minimization"));
    parameter_set_->setIntroduction(QString("Mesh Denoising via L0 Minimization -- Parameters"));
}
开发者ID:caomw,项目名称:GuidedDenoising,代码行数:35,代码来源:MeshDenoisingViaL0Minimization.cpp


示例6: WideCharToMultiByte

BOOL CGeometryProcDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
	CString fn = lpszPathName;
	char* filename = NULL;
	auto UnicodeToAnsi = [](char** file, CString& fn)
	{
		int P_Length = fn.GetLength();
		int nBytes = WideCharToMultiByte(CP_ACP, 0, fn, P_Length, NULL, 0, NULL, NULL);
		*file = new char[nBytes + 1];
		memset(*file, 0, P_Length + 1);
		WideCharToMultiByte(CP_OEMCP, 0, fn, P_Length, *file, nBytes, NULL, NULL);
	};
	UnicodeToAnsi(&filename, fn);
	string filecheck(filename);
	filecheck = filecheck.substr(filecheck.size()-4);
	std::transform(filecheck.begin(), filecheck.end(), filecheck.begin(), tolower);

	if (filecheck == (".stl"))
	{
		TriMesh* mesh = NULL;
		mesh = TriMesh::read_stl_helper(filename);
		mesh->need_bbox();
		meshes.push_back(mesh);
		Current_mesh = meshes.size() - 1;
		return TRUE;
	}
	return FALSE;
}
开发者ID:THTBSE,项目名称:Manufacture,代码行数:28,代码来源:GeometryProcDoc.cpp


示例7: PhysicsTick

//----------------------------------------------------------------------------
void GelatinCube::PhysicsTick ()
{
    mModule->Update((float)GetTimeInSeconds());

    // Update spline surface.  Remember that the spline maintains its own
    // copy of the control points, so this update is necessary.
    int numSlices = mModule->GetNumSlices() - 2;
    int numRows = mModule->GetNumRows() - 2;
    int numCols = mModule->GetNumCols() - 2;

    for (int s = 0; s < numSlices; ++s)
    {
        for (int r = 0; r < numRows; ++r)
        {
            for (int c = 0; c < numCols; ++c)
            {
                mSpline->SetControlPoint(c, r, s,
                    mModule->Position(s + 1, r + 1, c + 1));
            }
        }
    }

    mBox->UpdateSurface();

    for (int i = 0; i < mBox->GetNumChildren(); ++i)
    {
        TriMesh* mesh = StaticCast<TriMesh>(mBox->GetChild(i));
        mRenderer->Update(mesh->GetVertexBuffer());
    }
}
开发者ID:vijaynerella,项目名称:GeometricTools,代码行数:31,代码来源:GelatinCube.cpp


示例8: if

void MeshDenoisingBase::getFaceNeighbor(TriMesh &mesh, TriMesh::FaceHandle fh, FaceNeighborType face_neighbor_type, std::vector<TriMesh::FaceHandle> &face_neighbor)
{
    face_neighbor.clear();
    if(face_neighbor_type == kEdgeBased)
    {
        for(TriMesh::FaceFaceIter ff_it = mesh.ff_iter(fh); ff_it.is_valid(); ff_it++)
            face_neighbor.push_back(*ff_it);
    }
    else if(face_neighbor_type == kVertexBased)
    {
        std::set<int> neighbor_face_index; neighbor_face_index.clear();

        for(TriMesh::FaceVertexIter fv_it = mesh.fv_begin(fh); fv_it.is_valid(); fv_it++)
        {
            for(TriMesh::VertexFaceIter vf_it = mesh.vf_iter(*fv_it); vf_it.is_valid(); vf_it++)
            {
                if((*vf_it) != fh)
                    neighbor_face_index.insert(vf_it->idx());
            }
        }

        for(std::set<int>::iterator iter = neighbor_face_index.begin(); iter != neighbor_face_index.end(); ++ iter)
        {
            face_neighbor.push_back(TriMesh::FaceHandle(*iter));
        }
    }
}
开发者ID:caomw,项目名称:GuidedDenoising,代码行数:27,代码来源:MeshDenoisingBase.cpp


示例9: vba

//----------------------------------------------------------------------------
void ReflectionsAndShadows::CopyNormalToTCoord1 (Object* object)
{
    TriMesh* mesh = DynamicCast<TriMesh>(object);
    if (mesh)
    {
        VertexBufferAccessor vba(mesh);
        for (int i = 0; i < vba.GetNumVertices(); ++i)
        {
            vba.TCoord<Vector3f>(1, i) = vba.Normal<Vector3f>(i);
        }
        mRenderer->Update(mesh->GetVertexBuffer());
    }

    Node* node = DynamicCast<Node>(object);
    if (node)
    {
        for (int i = 0; i < node->GetNumChildren(); ++i)
        {
            Spatial* child = node->GetChild(i);
            if (child)
            {
                CopyNormalToTCoord1(child);
            }
        }
    }
}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:27,代码来源:ReflectionsAndShadows.cpp


示例10: vectorCopy3D

void FixMeshSurface::setVel()
{
    double conv_vel[3];
    int size, nVec;
    double scp, tmp[3], facenormal[3], ***v_node;
    vectorCopy3D(vSurf_,conv_vel);
    double conv_vSurf_mag = vectorMag3D(conv_vel);

    size = mesh()->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v")->size();
    nVec = mesh()->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v")->nVec();

    v_node = mesh()->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v")->begin();

    // set mesh velocity
    TriMesh *trimesh = triMesh();
    
    for (int i = 0; i < size; i++)
    {
        trimesh->surfaceNorm(i,facenormal);
        scp = vectorDot3D(conv_vel,facenormal);
        vectorScalarMult3D(facenormal,scp,tmp);
        for(int j = 0; j < nVec; j++)
        {
            vectorSubtract3D(conv_vel,tmp,v_node[i][j]);
            if(vectorMag3D(v_node[i][j]) > 0.)
            {
                vectorScalarDiv3D(v_node[i][j],vectorMag3D(v_node[i][j]));
                vectorScalarMult3D(v_node[i][j],conv_vSurf_mag);
                
            }
        }
    }
}
开发者ID:rbberger,项目名称:LIGGGHTS-PUBLIC,代码行数:33,代码来源:fix_mesh_surface.cpp


示例11: stdMesh

//----------------------------------------------------------------------------
void EditMap::CreateSphere (PX2::APoint pos)
{
	PX2::Texture2D *tex = DynamicCast<PX2::Texture2D>(
		ResourceManager::GetSingleton().BlockLoad("ToolRes/images/default.png"));
	if (!tex)
		return;

	StandardMesh stdMesh(mVertexFormat);
	TriMesh *mesh = stdMesh.Sphere(16, 16, 1);
	mesh->SetName("NoName");

	Texture2DMaterialPtr material = new0 Texture2DMaterial;
	mesh->SetMaterialInstance(material->CreateInstance(tex));

	ActorPtr actor = new0 Actor();
	actor->SetName("NoName");
	actor->SetMovable(mesh);
	actor->SetPosition(pos);
	actor->ComeInToEventWorld();

	AddActor(actor);

	Event *event = 0;
	event = EditorEventSpace::CreateEventX
		(EditorEventSpace::AddActor);
	event->SetData<Actor*>(actor);
	EventWorld::GetSingleton().BroadcastingLocalEvent(event);

	ActorAddDeleteCommand *command = new0 ActorAddDeleteCommand(actor);
	EditSystem::GetSingleton().GetCM()->PushUnDo(command);
}
开发者ID:ascetic85,项目名称:Phoenix3d,代码行数:32,代码来源:PX2EditMap.cpp


示例12: stdMesh

//----------------------------------------------------------------------------
void EditMap::CreateSphere (PX2::APoint pos)
{
	PX2::Texture2D *tex = DynamicCast<PX2::Texture2D>(
		ResourceManager::GetSingleton().BlockLoad("ToolRes/images/default.png"));
	if (!tex)
		return;

	StandardMesh stdMesh(mVertexFormat);
	TriMesh *mesh = stdMesh.Sphere(16, 16, 1);
	mesh->SetName("NoName");

	//Texture2DMaterialPtr material = new0 Texture2DMaterial;
	//mesh->SetMaterialInstance(material->CreateInstance(tex));

	StandardESMaterial_DefaultPtr mtl = new0 StandardESMaterial_Default();
	mesh->SetMaterialInstance(mtl->CreateInstance(tex, 0 ,0));

	ActorPtr actor = new0 Actor();
	actor->SetName("NoName");
	actor->SetMovable(mesh);
	actor->SetPosition(pos);
	actor->ComeInToEventWorld();

	AddActor(actor);

	ActorAddDeleteCommand *command = new0 ActorAddDeleteCommand(actor);
	EditSystem::GetSingleton().GetCM()->PushUnDo(command);
}
开发者ID:manyxu,项目名称:Phoenix3D_2.0,代码行数:29,代码来源:PX2EditMap.cpp


示例13: center

//----------------------------------------------------------------------------
void IntersectingBoxes::ModifyMesh (int i)
{
    Vector3f center(
        0.5f*(mBoxes[i].Min[0] + mBoxes[i].Max[0]),
        0.5f*(mBoxes[i].Min[1] + mBoxes[i].Max[1]),
        0.5f*(mBoxes[i].Min[2] + mBoxes[i].Max[2]));

    float xExtent = 0.5f*(mBoxes[i].Max[0] - mBoxes[i].Min[0]);
    float yExtent = 0.5f*(mBoxes[i].Max[1] - mBoxes[i].Min[1]);
    float zExtent = 0.5f*(mBoxes[i].Max[2] - mBoxes[i].Min[2]);

    Vector3f xTerm = xExtent*Vector3f::UNIT_X;
    Vector3f yTerm = yExtent*Vector3f::UNIT_Y;
    Vector3f zTerm = zExtent*Vector3f::UNIT_Z;

    TriMesh* mesh = StaticCast<TriMesh>(mScene->GetChild(i));
    VertexBufferAccessor vba(mesh);

    vba.Position<Vector3f>(0) = center - xTerm - yTerm - zTerm;
    vba.Position<Vector3f>(1) = center + xTerm - yTerm - zTerm;
    vba.Position<Vector3f>(2) = center + xTerm + yTerm - zTerm;
    vba.Position<Vector3f>(3) = center - xTerm + yTerm - zTerm;
    vba.Position<Vector3f>(4) = center - xTerm - yTerm + zTerm;
    vba.Position<Vector3f>(5) = center + xTerm - yTerm + zTerm;
    vba.Position<Vector3f>(6) = center + xTerm + yTerm + zTerm;
    vba.Position<Vector3f>(7) = center - xTerm + yTerm + zTerm;

    mesh->UpdateModelSpace(Visual::GU_NORMALS);
    mRenderer->Update(mesh->GetVertexBuffer());
}
开发者ID:vijaynerella,项目名称:GeometricTools,代码行数:31,代码来源:IntersectingBoxes.cpp


示例14: mAnimType

//----------------------------------------------------------------------------
Character::Character() :
mAnimType(AT_SKELETON),
mDefaultAnimID(0),
mBaseHPCurLevel(0.0f),
mIsDieDoDelete(true),
mBaseAPCurLevel(0.0f),
mIsDead(false),
mIsMovableAutoWorldBound(true),
mMovableAutoWorldBoundRadius(2.0f)
{
	SetName("Chara");

	PX2_INIT_PM_F(HP);
	PX2_INIT_PM_F(AP);

	VertexFormat *vf = PX2_GR.GetVertexFormat(GraphicsRoot::VFT_PC);
	StandardMesh stdMesh(vf);
	stdMesh.SetVertexColor(Float4(1.0f, 0.0f, 0.0f, 1.0f));
	TriMesh *mesh = stdMesh.Box(0.5f, 0.5f, 0.5f);
	PX2::VertexColor4MaterialPtr mtl = new0 VertexColor4Material();
	mtl->GetWireProperty(0, 0)->Enabled = true;
	mtl->GetCullProperty(0, 0)->Enabled = false;
	mesh->LocalTransform.SetUniformScale(0.5f);
	mesh->SetMaterialInstance(mtl->CreateInstance());
	CreateGetHelpNode()->DetachAllChildren();
	CreateGetHelpNode()->AttachChild(mesh);
	CreateGetHelpNode()->SetParentTransformIngore(false, false, true);
}
开发者ID:JamShan,项目名称:Phoenix3D_2.1,代码行数:29,代码来源:PX2Character.cpp


示例15:

	TriMesh<FloatType> Shapes<FloatType>::cylinder(const vec3<FloatType>& p0, const vec3<FloatType>& p1, FloatType radius, UINT stacks, UINT slices, const vec4<FloatType>& color) {
		FloatType height = (p1 - p0).length();

		TriMesh<FloatType> result = Shapesf::cylinder(radius, height, stacks, slices, color);
		result.transform(mat4f::translation(p0) * mat4f::face(vec3<FloatType>::eZ, p1 - p0));
		return result;
	}
开发者ID:billbliss3,项目名称:Opt,代码行数:7,代码来源:meshShapes.cpp


示例16: ModifyMesh

//----------------------------------------------------------------------------
void IntersectingBoxes::ModifyBoxes ()
{
    const int numBoxes = (int)mBoxes.size();
    int i;
    for (i = 0; i < numBoxes; ++i)
    {
        AxisAlignedBox3f box = mBoxes[i];

        float dx = Mathf::IntervalRandom(-4.0f, 4.0f);
        if (-mSize <= box.Min[0] + dx && box.Max[0] + dx <= mSize)
        {
            box.Min[0] += dx;
            box.Max[0] += dx;
        }

        float dy = Mathf::IntervalRandom(-4.0f, 4.0f);
        if (-mSize <= box.Min[1] + dy && box.Max[1] + dy <= mSize)
        {
            box.Min[1] += dy;
            box.Max[1] += dy;
        }

        float dz = Mathf::IntervalRandom(-4.0f, 4.0f);
        if (-mSize <= box.Min[2] + dz && box.Max[2] + dz <= mSize)
        {
            box.Min[2] += dz;
            box.Max[2] += dz;
        }

        mManager->SetBox(i, box);
        ModifyMesh(i);
    }

    mManager->Update();
    mScene->Update();

    // Switch material to red for any box that overlaps another.
    TriMesh* mesh;
    for (i = 0; i < numBoxes; ++i)
    {
        // Reset all boxes to blue.
        mesh = StaticCast<TriMesh>(mScene->GetChild(i));
        mesh->SetEffectInstance(mNoIntersectEffect);
    }

    const std::set<EdgeKey>& overlap = mManager->GetOverlap();
    std::set<EdgeKey>::const_iterator iter = overlap.begin();
    std::set<EdgeKey>::const_iterator end = overlap.end();
    for (/**/; iter != end; ++iter)
    {
        // Set intersecting boxes to red.
        i = iter->V[0];
        mesh = StaticCast<TriMesh>(mScene->GetChild(i));
        mesh->SetEffectInstance(mIntersectEffect);
        i = iter->V[1];
        mesh = StaticCast<TriMesh>(mScene->GetChild(i));
        mesh->SetEffectInstance(mIntersectEffect);
    }
}
开发者ID:vijaynerella,项目名称:GeometricTools,代码行数:60,代码来源:IntersectingBoxes.cpp


示例17: vectorCopy3D

void FixMeshSurface::initAngVel()
{
    int size, nVec;
    double rot_origin[3],rot_axis[3],rot_omega;
    vectorCopy3D(origin_,rot_origin);
    vectorCopy3D(axis_,rot_axis);
    rot_omega = omegaSurf_;
    double tmp[3], scp, unitAxis[3], tangComp[3], Utang[3], surfaceV[3];
    double node[3],facenormal[3], magAxis, magUtang, ***v_node;

    // register new element property v - error if exists already via moving mesh
    mesh()->prop().addElementProperty<MultiVectorContainer<double,3,3> >("v","comm_none","frame_invariant","restart_no");
    size = mesh()->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v")->size();
    nVec = mesh()->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v")->nVec();

    size = mesh()->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v")->size();
    nVec = mesh()->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v")->nVec();
    v_node = mesh()->prop().getElementProperty<MultiVectorContainer<double,3,3> >("v")->begin();

    // calculate unit vector of rotation axis
    magAxis = vectorMag3D(rot_axis);
    vectorScalarDiv3D(rot_axis,magAxis,unitAxis);

    TriMesh *trimesh = triMesh();
    for (int i = 0; i < size; i++)
    {
        trimesh->surfaceNorm(i,facenormal);
        // number of nodes per face (3)
        for(int j = 0; j < nVec; j++)
        {
            // position of node - origin of rotation (to get lever arm)
            trimesh->node(i,j,node);
            vectorSubtract3D(node,rot_origin,surfaceV);

            // lever arm X rotational axis = tangential component
            vectorCross3D(surfaceV,unitAxis,tangComp);

            // multiplying by omega scales the tangential component to give tangential velocity
            vectorScalarMult3D(tangComp,-rot_omega,Utang);

            // EPSILON is wall velocity, not rotational omega
            if(vectorMag3D(Utang) < EPSILON_V)
                error->fix_error(FLERR,this,"Rotation velocity too low");

            scp = vectorDot3D(Utang, facenormal);
            vectorScalarMult3D(facenormal,scp,tmp);

            // removes components normal to wall
            vectorSubtract3D(Utang,tmp,v_node[i][j]);
            magUtang = vectorMag3D(Utang);

            if(vectorMag3D(v_node[i][j]) > 0.)
            {
               vectorScalarDiv3D(v_node[i][j],vectorMag3D(v_node[i][j]));
               vectorScalarMult3D(v_node[i][j],magUtang);
            }
        }
    }
}
开发者ID:Polyun,项目名称:LIGGGHTS-PUBLIC,代码行数:59,代码来源:fix_mesh_surface.cpp


示例18: box

	TriMesh<FloatType> Shapes<FloatType>::box(const OrientedBoundingBox3f &obb, const vec4<FloatType>& color)
	{
		TriMesh<FloatType> result = box(BoundingBox3<FloatType>(vec3<FloatType>::origin, vec3<FloatType>(1.0f, 1.0f, 1.0f)), color);

		result.transform(obb.getOBBToWorld());

		return result;
	}
开发者ID:billbliss3,项目名称:Opt,代码行数:8,代码来源:meshShapes.cpp


示例19: load_background_mesh

void Scene::load_mesh(const string& filename, const Mat4x4f& transform)
{
  cout << "Loading " << filename << endl;
  TriMesh* mesh = load_background_mesh(filename, transform);

  // Correct scene bounding box
  AABB mesh_bbox = mesh->compute_bbox();
  bbox.add_AABB(mesh_bbox);
}
开发者ID:,项目名称:,代码行数:9,代码来源:


示例20:

TriMesh *SimpleMesh::getInternalMesh(Matrix44f transformMatrix) {
    TriMesh *meshCopy = new TriMesh{_currentMesh};
    vector<Vec3f> verts = meshCopy->getVertices();

    for (Vec3f &vertex : meshCopy->getVertices()) {
        vertex = transformMatrix.transformPoint(vertex);
    }
    return meshCopy;
}
开发者ID:,项目名称:,代码行数:9,代码来源:



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TriObject类代码示例发布时间:2022-05-31
下一篇:
C++ TriArray类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap