Jump to content

Cute little math trick


hrothgar

Recommended Posts

So, I'm sitting at work yesterday and one of our users needs an easy way to calculate the area of a trapezoid.

 

I still and think about things and come up with a decent enough solution using my old high school algebra.

 

I post the solution.

10 minutes later one of our developers comes back and replaced the entire function with less than a single line of code

 

Apparantly I forgot that the vector area of a quadrilateral is one half the cross product of the diagonals.

 

More significant, we never spent any real time on linear algebra back in High School. As a result, I lost on on a wealth of cute little tricks like this one.

 

Folks might find the following web site amusing:

 

http://softsurfer.com/Archive/algorithm_01...orithm_0101.htm

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...