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/gaolinorange/SDMNET_stamp
18 May 2021, 10:06:25 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    No releases to show
  • c6348d6
  • /
  • code
  • /
  • matlab
  • /
  • writeOBJ.m
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 ...

Permalinks

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
  • directory
  • revision
  • snapshot
origin badgecontent badge Iframe embedding
swh:1:cnt:fec628f5e25840cbb32fa5049d1a12bcf75bc6e1
origin badgedirectory badge Iframe embedding
swh:1:dir:5b298d389b6316f8629902ed23b1bc0d3bf031d7
origin badgerevision badge
swh:1:rev:5208f1210b77e3251dde3bdafc120a48dc69e833
origin badgesnapshot badge
swh:1:snp:9fffc6f3bfd48634db6bccb84405eef1bad9ef4b
Citations

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
  • directory
  • revision
  • 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: 5208f1210b77e3251dde3bdafc120a48dc69e833 authored by wutong on 27 March 2021, 07:58:47 UTC
Update ReconstructFromCodeMixIntegerReadingObjinAdvance.m
Tip revision: 5208f12
writeOBJ.m
function writeOBJ(filename, V,F,UV,TF,N,NF)
  % WRITEOBJ writes an OBJ file with vertex/face information
  %
  % writeOBJ(filename,V,F,UV,N)
  %
  % Input:
  %  filename  path to .obj file
  %  V  #V by 3 list of vertices
  %  F  #F by 3 list of triangle indices
  %  UV  #UV by 2 list of texture coordinates
  %  TF  #TF by 3 list of corner texture indices into UV
  %  N  #N by 3 list of normals
  %  NF  #NF by 3 list of corner normal indices into N
  %

%disp(['writing: ',filename]);
f = fopen( filename, 'w' );


if size(V,2) == 2
  warning('Appending 0s as z-coordinate');
  V(:,end+1:3) = 0;
else
  assert(size(V,2) == 3);
end
fprintf( f, 'v %0.17g %0.17g %0.17g\n', V');

hasN =  exist('N','var') && ~isempty(N);
hasUV = exist('UV','var') && ~isempty(UV);

if hasUV
    switch size(UV,2)
    case 2
      fprintf( f, 'vt %0.17g %0.17g\n', UV');
    case 3
      fprintf( f, 'vt %0.17g %0.17g %0.17g\n', UV');
    end
end

if hasN
    %for k=1:size(N,1)
    %    fprintf( f, 'vn %f %f %f\n', N(k,1), N(k,2), N(k,3) );
    %end
    fprintf( f, 'vn %0.17g %0.17g %0.17g\n', N');
end

if hasUV && (~exist('TF','var') || isempty(TF))
    TF = F;
end
if hasN && (~exist('NF','var') || isempty(NF))
    NF = F;
end

if ~hasN && ~hasUV
  % A lot faster if we just have faces and they're all triangles
  fmt = repmat(' %d',1,size(F,2));
  fprintf( f,['f' fmt '\n'], F');
else
  for k=1:size(F,1)
      if ( (~hasN) && (~hasUV) ) || (any(TF(k,:)<=0,2) && any(NF(k,:)<=0,2))
          fmt = repmat(' %d',1,size(F,2));
          fprintf( f,['f' fmt '\n'], F(k,:));
      elseif ( hasUV && (~hasN || any(NF(k,:)<=0,2)))
          fmt = repmat(' %d/%d',1,size(F,2));
          fprintf( f, ['f' fmt '\n'], [F(k,:);TF(k,:)]);
      elseif ( (hasN) && (~hasUV || any(TF(k,:)<=0,2)))
          fmt = repmat(' %d//%d',1,size(F,2));
          fprintf( f, ['f' fmt '\n'],[F(k,:);TF(k,:)]');
      elseif ( (hasN) && (hasUV) )
          assert(all(NF(k,:)>0));
          assert(all(TF(k,:)>0));
          fmt = repmat(' %d/%d/%d',1,size(F,2));
          fprintf( f, ['f' fmt '\n'],[F(k,:);TF(k,:);NF(k,:)]);
      end
  end
end


fclose(f);

back to top

Software Heritage — Copyright (C) 2015–2025, 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— Contact— JavaScript license information— Web API