15 Jun 2017

Finding Intersection Point(s) of Two Circles

收藏到CSDN网摘
This is a very common problem of finding the intersection point(s) of two circles. Visually, it is easy to define the three cases: no intersection, touching (single intersection point), and two intersection points. Analytically, mathematical calculations are required to work out the exact intersection position(s) (if any) by using the equations of the two circles. A more detailed explanation could be find from HERE and HERE.


Below, it's my implementation in Matlab. The inputs are c1 and c2, which are both vectors representing a circle in the format of [x,y,d]. The output is the point list matrix sorted using y coordinates. If there is no intersection, it is an empty matrix. For touching case, it is a single-row matrix (or vector) in the format of [x,y]. Otherwise, it is a 2*2 matrix forming by the coordinates of the two intersection points: [x1,y1;x2,y2].

5 Jun 2017

Excel Spreadsheet Format

收藏到CSDN网摘
MS's flagship office suits are widely used everywhere, even by the calculation-extensive engineering world. There are always someone that like Excel much more than the others. From a software engineer's point of view, it might be more straightforward to extract information directly from the file itself. MS provides the COM objects. The .net platform also enables a more generic but user-friendly way of manipulating office documents including docx and xlsx files. If you'd like to stay ways from COM or .Net platform, you'd better to find another way of doing it. This article illustrates how. I will focus on excel file rather than docx. But the concept should be similar, unless you show me it's not the case :-)