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

Revision 39b13612ebd645a65eda854771b517371f2f858a authored by ennetws on 13 March 2015, 18:17:18 UTC, committed by ennetws on 13 March 2015, 18:17:18 UTC
Create README.md
1 parent c702819
  • Files
  • Changes
  • adfc2e5
  • /
  • nurbs_plugin
  • /
  • nurbs_plugin_global.h
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.

  • revision
  • directory
  • content
revision badge
swh:1:rev:39b13612ebd645a65eda854771b517371f2f858a
directory badge
swh:1:dir:1527aafa4f478fbed854d026dc9a61c6f21f769d
content badge
swh:1:cnt:22fa93f864901b0ca999eda4715e5d8cf3e4c7ec

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
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
nurbs_plugin_global.h
#pragma once

#define M_PI       3.14159265358979323846
#define M_PI_2     1.57079632679489661923
#define M_PI_4     0.785398163397448309616

#include "SurfaceMeshHelper.h"

using namespace SurfaceMesh;

static inline Scalar deg_to_rad(const Scalar& _angle)
{ return M_PI*(_angle/180.0); }

static inline Scalar rad_to_deg(const Scalar& _angle)
{ return 180.0*(_angle/M_PI); }

static inline Scalar sane_aarg(Scalar _aarg){
	if (_aarg < -1)
		_aarg = -1;
	else if (_aarg >  1)
		_aarg = 1;
	return _aarg;
}

static inline Scalar angle(Scalar _cos_angle, Scalar _sin_angle)
{//sanity checks - otherwise acos will return NAN
	_cos_angle = sane_aarg(_cos_angle);
	return (Scalar) _sin_angle >= 0 ? acos(_cos_angle) : -acos(_cos_angle);
}

// Helper function
static Scalar calc_dihedral_angle(SurfaceMeshModel * mesh, SurfaceMeshModel::Halfedge _heh)
{
	if (mesh->is_boundary(mesh->edge(_heh)))
	{//the dihedral angle at a boundary edge is 0
		return 0;
	}

	Vector3FaceProperty normal = mesh->face_property<Vector3>( FNORMAL );
	Vector3VertexProperty points = mesh->vertex_property<Vector3>( VPOINT );

	const Normal& n0 = normal[mesh->face(_heh)];
	const Normal& n1 = normal[mesh->face(mesh->opposite_halfedge(_heh))];

	Normal he = points[mesh->to_vertex(_heh)] - points[mesh->from_vertex(_heh)];

	Scalar da_cos = dot(n0, n1);

	//should be normalized, but we need only the sign
	Scalar da_sin_sign = dot(cross(n0, n1), he);
	return angle(da_cos, da_sin_sign);
}
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