Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
content badge
swh:1:cnt:cbce6deb95b6fb19f5b615127eb1b4ae617d7ba3

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
#include "FEM_interface.h"
#include "GL/glut.h"
using namespace FEM;
void
GUI::
DrawWorld(const std::shared_ptr<World>& world)
{
	const Eigen::VectorXd& X = world->GetPositions();
	const auto& cs = world->GetConstraints();

	for(const auto& c : cs)
		DrawConstraint(c, X);

}

void
GUI::
DrawConstraint(const std::shared_ptr<Cst>& c,const Eigen::VectorXd& x)
{
	glDisable(GL_LIGHTING);
	if(dynamic_cast<AttachmentCst*>(c.get()) != nullptr)
	{
		AttachmentCst* ac = dynamic_cast<AttachmentCst*>(c.get());	
		int i0 = ac->GetI0();
		const Eigen::Vector3d& p = ac->GetP();
		// glLineWidth(3.0);
		// GUI::DrawLine(x.block<3,1>(i0*3,0),p,Eigen::Vector3d(0.8,0,0));
		// glLineWidth(1.0);
	}
	else if(dynamic_cast<CorotateFEMCst*>(c.get()) != nullptr)
	{
		CorotateFEMCst* cc = dynamic_cast<CorotateFEMCst*>(c.get());
		int i0 = cc->GetI0();
		int i1 = cc->GetI1();
		int i2 = cc->GetI2();
		int i3 = cc->GetI3();

		const Eigen::Vector3d& p0 = x.block<3,1>(i0*3,0);
		const Eigen::Vector3d& p1 = x.block<3,1>(i1*3,0);
		const Eigen::Vector3d& p2 = x.block<3,1>(i2*3,0);
		const Eigen::Vector3d& p3 = x.block<3,1>(i3*3,0);

		GUI::DrawTetrahedron(p0,p1,p2,p3);
		glLineWidth(2.0);
		GUI::DrawLine(p0,p1,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p0,p2,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p0,p3,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p1,p2,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p1,p3,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p2,p3,Eigen::Vector3d(0,0,0));

		glLineWidth(1.0);
	}
	else if(dynamic_cast<LinearMuscleCst*>(c.get()) != nullptr)
	{
		LinearMuscleCst* cc = dynamic_cast<LinearMuscleCst*>(c.get());
		int i0 = cc->GetI0();
		int i1 = cc->GetI1();
		int i2 = cc->GetI2();
		int i3 = cc->GetI3();
		double a = cc->GetActivationLevel();
		const Eigen::Vector3d& p0 = x.block<3,1>(i0*3,0);
		const Eigen::Vector3d& p1 = x.block<3,1>(i1*3,0);
		const Eigen::Vector3d& p2 = x.block<3,1>(i2*3,0);
		const Eigen::Vector3d& p3 = x.block<3,1>(i3*3,0);

		GUI::DrawTetrahedron(p0,p1,p2,p3,Eigen::Vector3d(1.0,1.0-a,1.0-a));
		glLineWidth(2.0);
		GUI::DrawLine(p0,p1,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p0,p2,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p0,p3,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p1,p2,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p1,p3,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p2,p3,Eigen::Vector3d(0,0,0));

		glLineWidth(1.0);
	}
	else if(dynamic_cast<BarycentricAttachmentCst*>(c.get()) != nullptr)
	{
		BarycentricAttachmentCst* cc = dynamic_cast<BarycentricAttachmentCst*>(c.get());
		int i0 = cc->GetI0();
		int i1 = cc->GetI1();
		int i2 = cc->GetI2();
		int i3 = cc->GetI3();
		const Eigen::Vector3d& p0 = x.block<3,1>(i0*3,0);
		const Eigen::Vector3d& p1 = x.block<3,1>(i1*3,0);
		const Eigen::Vector3d& p2 = x.block<3,1>(i2*3,0);
		const Eigen::Vector3d& p3 = x.block<3,1>(i3*3,0);

		GUI::DrawTetrahedron(p0,p1,p2,p3,Eigen::Vector3d(1.0,0,0));
		glLineWidth(2.0);
		GUI::DrawLine(p0,p1,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p0,p2,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p0,p3,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p1,p2,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p1,p3,Eigen::Vector3d(0,0,0));
		GUI::DrawLine(p2,p3,Eigen::Vector3d(0,0,0));

		glLineWidth(1.0);
	}
	glEnable(GL_LIGHTING);
}

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API