Editores de Texto

noviembre 27, 2011

Windows
notepad++ (MEL definition)
mi (windows ver.)

Mac
mi (mel definition)
TextWrangler
Carbon emacs
Vim

Linux

Multiplataforma (java)
jEdit


Interval tree for 2D intersection tests

octubre 14, 2010

“We can use the interval tree [Ede83] for static query, as well as for the
rectangle intersection problem. Each query of interval intersection takes
O(logn + k) time where k is the number of reported intersection and n
is the number of intervals. Therefore, reporting intersection among n
rectangles can be done in O(nlogn + K) where K is the total number of
intersecting rectangles.”

Collision detection between geometricmodels: a survey
Ming C. Lin & Stefan Gottschalk


Japanese Latex on Mac in texshop, including Beamer

agosto 31, 2010

Option 1) Use CJK pakage (CJKutf8 for UTF-8 encoding) and use normal latex

¥usepackage[10pt]{type1ec} % use only 10pt fonts
¥usepackage[T1]{fontenc}
¥usepackage{CJKutf8}
¥usepackage[german, russian, vietnam, USenglish]{babel}
¥usepackage[overlap, CJK]{ruby}
¥usepackage{CJKulem}
¥renewcommand{¥rubysep}{-0.2ex}
¥newenvironment{Japanese}{%
¥CJKfamily{min}%
¥CJKtilde
¥CJKnospace}{}
¥begin{document}
¥begin{CJK}{UTF8}{}
¥begin{Japanese}
これは日本語の文章
¥end{Japanese}
¥end{CJK}
¥end{document}

A latex code

Option 2) Use ptex (platex) *Recommended

Install by Macports:
sudo port install pTeX +hiragino +otf +utf8 +motif +macosx

In texshop->configuration, change “Profile” (a Drop menu at the bottom) to pTeX (EUC).
Save a tex file in EUC encoding.

I had to modify the file “/Users/carlos/Library/TeXShop/bin/platex2pdf-euc” to change path to “opt” instead of “usr”

If fontspec is needed:
sudo tlmgr update –self
sudo tlmgr install fontspec

%¥documentclass[twocolumn,11pt]{jarticle} %In case two column layout
¥documentclass[a4j]{jarticle}
¥usepackage{graphicx} %for including graphics
¥usepackage{nidanfloat}
¥usepackage{url}
¥title{タイトル}
¥author{ 僕の名前 }
¥date{2010年}
¥renewcommand{¥refname}{References}
¥begin{document}
¥maketitle
¥section{テスト}
これはテストです。
¥end{document}

A latex code

To use Beamer with platex, I had to reinstall the caption package in CTAN (Download all the .ins and .dtx files and type “platex caption.ins” in the terminal; copy to current directory). The following templete from here was useful:

\documentclass[14pt,dvipdfm]{beamer}
% pdfの栞の字化けを防ぐ
% \AtBeginDvi{\special{pdf:tounicode EUC-UCS2}}
% テーマ
\usetheme{AnnArbor}
% navi. symbolsは目立たないが,dvipdfmxを使うと機能しないので非表示に
\setbeamertemplate{navigation symbols}{}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
% フォントはお好みで
\usepackage{txfonts}
\mathversion{bold}
\renewcommand{\familydefault}{\sfdefault}
\renewcommand{\kanjifamilydefault}{\gtdefault}
\setbeamerfont{title}{size=\large,series=\bfseries}
\setbeamerfont{frametitle}{size=\large,series=\bfseries}
\setbeamertemplate{frametitle}[default][center]
\usefonttheme{professionalfonts}
%
\title{PowerPoint{\color{red}なしで}
プレゼンテーション}
\author{かさい ますみ}
\institute{弘前大学}
\date{2005年12月吉日}
\begin{document}
\frame{\titlepage}
\end{document}

To include furigana (small kana above the kanji), use furikana.sty

Y copied all files to /opt/local/share/Library/texmf/ptex/platex/base and ran sudo mktexlsr
Include
\usepackage{furikana}
in your document.
use the “kana” command: ¥kana{漢}{かん}¥kana{字}{じ}

This made me a problem in beamer (an @ appeared in the background), so I had to use the following marco (found here) instead:
%
% macro ルビ usage: \ruby{漢}{かん}\ruby{字}{じ}
%
\def\ruby#1#2{%
\leavevmode
\setbox0=\hbox{#1}\setbox1=\hbox{\tiny#2}%
\ifdim\wd0>\wd1 \dimen0=\wd0 \else \dimen0=\wd1 \fi
\hbox{\kanjiskip=\fill
\vbox{\hbox to \dimen0{\tiny \hfil#2\hfil}%
\nointerlineskip
\hbox to \dimen0{\hfil#1\hfil}}}}


DevIL on Mac with PNG support

junio 3, 2010

DevIL is a library to manage many kind of image formats, as jpg, bmp, jpg, tga..
In Mac, can be installed libpng or libpng12 in darwin ports (mac ports) for png format, and then configure DevIL by:

./configure CC=”gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk” CFLAGS=”-I/sw/include -L/sw/lib” LDFLAGS=”-L/sw/lib”

As an alternative, by installing libpng (and libjpg) by this binary file:

http://ethan.tira-thompson.org/Mac_OS_X_Ports.html

and configure DevIL by:
./configure CC=”gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk” CFLAGS=”-I/usr/local/include/libpng -L/local/lib” LDFLAGS=”-L/local/lib”

On both cases, run:
autoreconf -i
before ./configure

and
make
sudo make install

to install


Implicit representation of a sphere and cube on a regular grid

mayo 4, 2010


void MakeSphere(Grid &grid, Double h, const Vector &pos, Double radius)
{
FOR_ALL
grid[INDEX(i,j,k)] =((pos-Vector(i,j,k)).Length()-radius) *h;
END_THREE
}


void MakeCube(Grid &init, Double h, const Vector &pos1, const Vector &pos2)
{
FOR_ALL_LS
//Find Nearest Point
Vector Nearest;
Nearest[0] = Clamp((Float)i,pos1[0],pos2[0]);
Nearest[1] = Clamp((Float)j,pos1[1],pos2[1]);
Nearest[2] = Clamp((Float)k,pos1[2],pos2[2]);
if(Nearest[0]==i&&Nearest[1]==j&&Nearest[2]==k){ //inside
Double d1 = min(abs(i-pos1[0]),abs(i-pos2[0]));
Double d2 = min(abs(j-pos1[1]),abs(j-pos2[1]));
Double d3 = min(abs(k-pos1[2]),abs(k-pos2[2]));
init(i,j,k) = -min(d1,min(d2,d3))* h;
}else{ //outside
init(i,j,k) = (Nearest-Vector(i,j,k)).Length()* h;
}
END_FOR_THREE
}


Delaunay triangulations

mayo 4, 2010

Sometimes we want to divide a space (delimited by a polygon / polyhedral representation) into triangles. This is useful for calculations inside a body such as stress in elastic / breaking simulations and also fluid simulation. There are many ways to to do this. Delaunay is optimal since avoids “skinny triangles”. Algorithms to create Delaunay triangulations include: Flip method, incremental, divide and conquer, and sweepline. For 3D triangle construction from a isosurface input, “isosurface stuffing” (Labelle, SIGGRAPH 2007) can be used:

“The isosurface stuffing algorithm by Labelle and Shewchuk produces a well-conditioned mesh by snapping some vertices to the triangulated surface and refining others using a precomputed stencil”.

Useful when higher resolution is desired near the surface.

Some useful triangulation code:

Triangle

http://www.compgeom.com/~piyush/scripts/triangle/index.html

(in 2D!)

Pyramid
3D version of Triangle but maybe it is not available?

Qhull

http://www.qhull.org/

CGAL

http://www.cgal.org/Manual/last/doc_html/cgal_manual/packages.html#Pkg:Triangulation3

LEDA

http://www.algorithmic-solutions.com/leda/ledar/index.htm


Text in OpenGL

marzo 21, 2010

There are various ways for including text in a OpenGL.
Some of them are discussed here:
http://www.opengl.org/resources/features/fontsurvey/


Installing Wi-fi and Opera Mini on a Palm Tungsten T5 in 2010

marzo 2, 2010

After some years I got a cheap Wi-Fi card for my Palm Tungsten T5. I got the CD but instead, I used the Wi-Fi driver installer from the palm site. Then I got the JVM (Java Virtual Machine) files from PDATungsteno, look for JVM.zip in here. Then I got a .prc version (palm installer) of opera mini, since installing the .jar files of the latest version was not working (fatal exceptions). This was the tricky part, as the files are not shown in the Opera Mini site, but they can still been downloaded if you have the correct link. I got opera-mini-4.2.14912-advanced-ja.prc from http://mini.opera.com/global/opera-mini-4.2.14912-advanced-int.prc . You can change “int” for other languages, for example “jp” for Japanese, “us” for United States, “es” for Spain, and so on. I also got a twitter and gmail Java midlets (some games are available as well). I am still having trouble showing the japanese font in these.


Simplificando meshes

junio 13, 2008

Para algunas aplicaciones se necesitan meshes con el mayor numero de vertices y caras para mostrar detalle.  Para otras no se necesita tanto, por ejemplo aplicaciones en tiempo real, colisiones, etc.  “Qslim” es uno de los algoritmos más usados ya que reduce los meshes de triangulas rapidamente y sin perder detalles hasta que se simplifica demasiado.

Pude compilar la version de linea de comandos en MacOS X leopard, pero no la version de interface grafica.  http://graphics.cs.uiuc.edu/~garland/software/qslim.html

  • Michael Garland and Paul S. Heckbert, Surface Simplification Using Quadric Error Metrics, in Proceedings of SIGGARPH’97, pp. 209-216, 1997.

For more accurate results, NSA (Normal-Based Simplification Algorithm for Meshes) can be used as well

http://www.di.ubi.pt/~fsilva/nsa/


Rigid Body Collision and how to make a Distance Field from Triangle mesh

febrero 14, 2008

“Non-convex rigid bodies with stacking” by Eran Guendelman, Robert Bridson and Ronald Fedkiw

http://www.rowlhouse.co.uk/jiggle/index.html

Generating Signed Distance Fields From Triangle , J. Andreas Bærentzen and Henrik Aanæs

http://www-cs-students.stanford.edu/~eparker/files/PhysicsEngine/


Seguir

Get every new post delivered to your Inbox.