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

https://github.com/sueda/eol-cloth
16 March 2020, 03:50:51 UTC
  • Code
  • Branches (2)
  • Releases (0)
  • Visits
Revision 2323d9f6471bbf5dc63979216a3ed3c97ff3538a authored by Weidner on 13 July 2018, 15:37:58 UTC, committed by Weidner on 13 July 2018, 15:37:58 UTC
Solver solving using old deform grad method. Still some bugs, but going to clean up force filling
1 parent db932cf
  • Files
  • Changes
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/heads/v0.2
    • 2323d9f6471bbf5dc63979216a3ed3c97ff3538a
    No releases to show
  • d1d7c25
  • /
  • src
  • /
  • boxTriCollision.h
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

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.

  • revision
  • directory
  • content
  • snapshot
origin badgerevision badge
swh:1:rev:2323d9f6471bbf5dc63979216a3ed3c97ff3538a
origin badgedirectory badge
swh:1:dir:c20624e70e5cd14d345c6b7fa8a72714b3bed2d5
origin badgecontent badge
swh:1:cnt:6a93eed52df1223c64c4f117ffd43a5ee694f170
origin badgesnapshot badge
swh:1:snp:283fc0df3963669dc87db8b6fd8259953e6e6732

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.

  • revision
  • directory
  • content
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 2323d9f6471bbf5dc63979216a3ed3c97ff3538a authored by Weidner on 13 July 2018, 15:37:58 UTC
Solver solving using old deform grad method. Still some bugs, but going to clean up force filling
Tip revision: 2323d9f
boxTriCollision.h
#pragma once
#ifndef BOXTRICOLLISION_H_
#define BOXTRICOLLISION_H_

#include <memory>
#include <vector>
#define EIGEN_DONT_ALIGN_STATICALLY
#include <Eigen/Dense>

// Throughout this code, `1` refers to the box and `2` refers to the cloth.
// For example, `pos1` is the collision point on the box, and `pos2` is the
// collision point on the cloth.

namespace btc
{

	/**
	* The vertex ordering is as follows:
	*
	*      x2
	*     /  \
	*    / t0 \
	*   /      \
	* x0--edge--x1
	*   \      /
	*    \ t1 /
	*     \  /
	*      x3
	*/
	class Edge
	{
	public:
		Edge();
		virtual ~Edge();

		Eigen::Vector4i verts;
		Eigen::Vector2i faces;
		bool internal;
		double angle;
		Eigen::Vector3d normals[2];
	};

	void createEdges(
		std::vector<std::shared_ptr<Edge> > &edges, // output
		const Eigen::MatrixXi &faces, // input
		const Eigen::MatrixXd &verts  // input
	);

	class Collision
	{
	public:
		Collision();
		virtual ~Collision();

		// The collision can be Vert-Face, Face-Vert, or Edge-Edge.
		// Vert-Face:
		//   count1 = 1
		//   count2 = 3
		//   verts1 = [i -1 -1], where i is the vertex index for box
		//   verts2 = [i j k], where i, j, k are the vertex indices for cloth
		//   weights1 = [a 0 0], where a is the box vertex weight for i
		//   weights2 = [a b c], where a, b, c, are the cloth vertex weights for i, j, k
		//   tri1 = -1
		//   tri2 = i, where i is the triangle index for cloth
		//   edge1 = [a b c ...], wher a, b, c, etc. are the edge indices of the surrounding edges
		//   edge2 = -1
		// Edge-Edge:
		//   count1 = 2
		//   count2 = 2
		//   verts1 = [i j -1], where i, j are the vertex indices for box
		//   verts2 = [i j -1], where i, j are the vertex indices for cloth
		//   weights1 = [a b 0], where a, b are the box vertex weight for i, j
		//   weights2 = [a b 0], where a, b are the cloth vertex weights for i, j
		//   tri1 = -1
		//   tri2 = -1
		//   edge1 = [i], where i is the edge index for box
		//   edge2 = i, where i is the edge index for cloth
		// Face-Vert:
		//   count1 = 3
		//   count2 = 1
		//   verts1 = [i j k], where i, j, k are the vertex indices for box
		//   verts2 = [i -1 -1], where i is the vertex index for cloth
		//   weights1 = [a b c], where a, b, c, are the cloth vertex weights for i, j, k
		//   weights2 = [a 0 0], where a is the box vertex weight for i
		//   tri1 = i, where i is the triangle index for box
		//   tri2 = -1
		//   edge1 = []
		//   edge2 = -1

		double dist; // distance
		Eigen::Vector3d nor1; // normal
		Eigen::Vector3d nor2; // normal on cloth
		Eigen::Vector3d pos1; // position on box
		Eigen::Vector3d pos2; // position on cloth
		Eigen::Vector3d pos1_; // position on box offset to be slightly inside
		int count1; // Collision type for box:   1=vert, 2=edge, 3=face
		int count2; // Collision type for cloth: 1=vert, 2=edge, 3=face
		Eigen::Vector3i verts1; // The collided vertices on box
		Eigen::Vector3i verts2; // The collided vertices on cloth
		Eigen::Vector3d weights1; // The vertex weights on box
		Eigen::Vector3d weights2; // The vertex weights on cloth
		int tri1; // Triangle index for box
		int tri2; // Triangle index for cloth
		std::vector<int> edge1; // all surrounding edge indices for he box
		int edge2; // edge index for cloth
	};

	/**
	* Main function
	* OUTPUT
	*   collisions: a vector of detected collisions
	* INPUT
	*   threshold: detection threshold (e.g., 1e-5)
	*   whd1: box dimensions
	*   E1: box frame
	*   verts2: 3xn matrix of cloth vertices
	*   faces2: 3xm matrix of cloth faces
	*/
	void boxTriCollision(
		std::vector<std::shared_ptr<Collision> > &collisions,
		double threshold,
		const Eigen::Vector3d &whd1,
		const Eigen::Matrix4d &E1,
		const Eigen::MatrixXd &verts2,
		const Eigen::MatrixXi &faces2,
		const Eigen::VectorXi &isEOL2,
		bool EOL);

	/**
	* Same as above, but doesn't create the edge structure. If the edge structure
	* is already created, then call this function. Otherwise, call the function
	* above, which creates the edge structure based on verts2 and faces2.
	*/
	void boxTriCollision(
		std::vector<std::shared_ptr<Collision> > &collisions,
		double threshold,
		const Eigen::Vector3d &whd1,
		const Eigen::Matrix4d &E1,
		const Eigen::MatrixXd &verts2,
		const Eigen::MatrixXi &faces2,
		const Eigen::VectorXi &isEOL2,
		bool EOL,
		const std::vector<std::shared_ptr<Edge> > &edges2);

	///////////////////////////////////////////////////////////////////////////////

	void pointTriCollision(
		std::vector<std::shared_ptr<Collision> > &collisions,
		double threshold,
		const Eigen::MatrixXd &verts1,
		const Eigen::MatrixXd &norms1,
		const Eigen::MatrixXd &verts2,
		const Eigen::MatrixXi &faces2,
		bool EOL);

}

#endif
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

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