
Archive for January, 2012
serendipity on the walls of the musée d’art et d’histoire
Monday, January 30th, 2012modernity in japan
Monday, January 30th, 2012intrinsic cotangent formula
Monday, January 23rd, 2012Here’s a derivation of the cotangent of an angle α of a triangle ABC given just the lengths of each side of the triangle.

First of all we remind ourselves what cotangent is in terms of cosine and sine:
cos α
cot α = ------
sin α
Now look at cosine and sine separately. By the law of cosines we have that
a2 = b2 + c2 - 2bc cos α
Rearranging things we have that
-a2 + b2 + c2
cos α = ------------
2bc
Now looking at the sine, we start with the familiar area of the triangle treating b as the base.
1
A = --- bh
2
Using SOH-CAH-TOA, we replace the height:
1
A = --- bc sin α
2
Rearranging this we have:
2A
sin α = ----
bc
Now put the cosine and sine derivations together to get:
cos α -a2 + b2 + c2 bc
cot α = ------ = ------------ ----
sin α 2bc 2A
Finally arriving at:
-a2 + b2 + c2
cot α = ------------
4A
hdlr
Monday, January 23rd, 2012Shuffle rows of a matlab matrix
Sunday, January 15th, 2012Neat little trick using the keyword end:
M = M(randperm(end),:);
Matlab colorbar without ticks
Sunday, January 15th, 2012Took a me a little bit to figure out how to make a color bar in matlab without tick marks.
hcb=colorbar;
set(hcb,'YTick',[])
Display wireframe mesh in matlab and save as vector graphics
Saturday, January 14th, 2012For our siggraph submission I wanted to overlay a 2D image with the wireframe of the mesh we use to deform it. In matlab I can display a 2D mesh (V,F) easily using:
trisurf(F,V(:,1),V(:,2),0*V(:,1));
view(2);
axis equal;
If I save this as .eps then I get a nice vector graphics version of my mesh.
But if I don’t want the filled faces to show up in the vector output, then when I try to save the following figure as a .eps file:
trisurf(F,V(:,1),V(:,2),0*V(:,1),'FaceAlpha',0);
view(2);
axis equal;
matlab just pretends to make a postscript vector file but instead its just a .eps file containing a raster image.
Here’s what I do to get a .eps vector graphics postscript file (which can then be turned into a PDF since output to PDF is broken in matlab):
E = edges(F);
plot([V(E(:,1),1) V(E(:,2),1)]',[V(E(:,1),2) V(E(:,2),2)]','k-');
view(2);
axis equal
set(gcf, 'Color', [1,1,1]);
set(gca, 'visible', 'off');
complimented by spam, complemented by spam
Tuesday, January 10th, 2012
complimented
by spam
complemented
Screen capture a remote desktop into the remote clipboard
Friday, January 6th, 2012I’m working a bit with Apple Remote Desktop now and I’m having trouble taking screen captures. It seems easy to take a screen capture that ends up as a file on or in the clipboard of the client side. But I’d rather be completely immersed in the remote computer, so ideally when I hit CMD+SHIFT+3 I’d get a screen shot the size and resolution of my remote desktop saved to the remote’s clipboard.
Here’s what I’m doing for now. I prepare my app that I want to screen capture then I switch to terminal and issue
echo "tell application \"skinning\" to activate" | osascript - && screencapture -c
This switches to my app and takes a screen capture into the clipboard.

