Tokenizing/splitting string in c++

Posted on Leave a commentPosted in cpp, Uncategorized

This method uses strtok to tokeninze our string given a specific delimeter, results of that are put into supplied vector. There are few other ways we can do this but this one is straight forward. #include <iostream> #include <string> #include <string.h>   #include <memory> #include <stdlib.h> #include <stdio.h> #include <list> #include <vector>   using namespace […]

Calculating partial Hausdorff Distance

Posted on 1 CommentPosted in cpp

  struct Point { Point(int_t _x, int_t _y) : x(_x), y (_y) {   }   int_t x; int_t y; };     typedef std::list<Point*> points_t;   double euclideanDistance(const Point& lhs,const Point& rhs) { double p1 = std::pow((float)(rhs.x – lhs.x), 2); double p2 = std::pow((float)(rhs.y – lhs.y), 2); double vd = std::sqrt(p1 + p2);   […]

Compiling Webkit on Windows using Visual Studio 2012

Posted on Leave a commentPosted in cpp, development

Just some notes on compiling WebKit on windows with visual studio. Issues : C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xrefwrap(431): error C2064: term does not evaluate to a function taking 1 arguments (..\..\win\WebCoreSupport\WebFrameLoaderClient.cpp) 25> C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\functional(239) : see reference to function template instantiation ‘_Ret std::_Callable_obj::_ApplyX(_V0_t &&)’ being compiled 25> with 25> [ […]

Calculate centroid of 2D non crossing polygon

Posted on Leave a commentPosted in java

Calculate centroid of 2D non crossing polygon, To accommodate that points are correct using Gift wrapping algorithm(Finding Convex Hull) Test case   import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull;   import java.awt.Point; import java.util.ArrayList; import java.util.Arrays; import java.util.List;   import org.junit.Test;   public class MathUtilTest {   @Test public void computeCentroidWithHull() { Point p1 = new […]