User Profile

Collapse

Profile Sidebar

Collapse
gayathri81
gayathri81
Last Activity: Sep 11 '12, 11:23 AM
Joined: Jul 16 '12
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • gayathri81
    replied to Surveillance Timer
    in C
    Hello Sir

    Thanks for the mail. As you told I am trying to run the thread in parallel. For this purpose I am trying to make the thread sleep using boost.

    I used this:
    Code:
    boost::this_thread(boost::chrono::milliseconds(50));
    However I am getting an error: unable to resolve identifier chrono.When I try to include the header file
    Code:
    #include <boost/chrono.hpp>
    Then I get an error "cannot
    ...
    See more | Go to post
    Last edited by zmbd; Sep 11 '12, 11:37 AM. Reason: (z) Added required code tags

    Leave a comment:


  • gayathri81
    replied to Surveillance Timer
    in C
    Hello Sir

    It would be nice if I could have the C++ example. Meanwhile as you told, I tried this out:

    I have a variable, say x which is equal to the value of the surveillance timer. Let us say x= 60;
    I am outside the geofence.
    I want to start the cpu clock and when it reaches 60 (i.e. the value of x) , it should stop the clock and print something .

    I did the following:
    Code:
    double diff;
    ...
    See more | Go to post
    Last edited by zmbd; Sep 11 '12, 11:36 AM. Reason: (z) added required code tags

    Leave a comment:


  • gayathri81
    replied to Point in polygon
    in C
    Hello

    Thank you for the solution. But I could not understand this :
    double distance = calculateDistan ce(position, *iter);

    I am a starter with vector in C++ and I am trying to develop myself.
    See more | Go to post

    Leave a comment:


  • gayathri81
    replied to Point in polygon
    in C
    Hallo

    Yes you are right. This statement always returns me 0 even if the point is outside or inside. Or how should I modify the code above to get even for outside and odd for inside ( ray casting method)? Please help me out.
    See more | Go to post

    Leave a comment:


  • gayathri81
    replied to Point in polygon
    in C
    Hello
    I perfectly agree with you. I have done what you have told. Now I want to call the polygon algorithm. I tried this out but did not work.
    Code:
    if(isInside(curPosition.position))
    {
    //push geofences inside.
    }
    // Function to check whether the point is inside or outside the 
    //polygon : concept of ray casting algorithm
    bool DataProcessor::isInside(Point& p)
     {
        
        int i,j= this->points.size()-1;
    ...
    See more | Go to post
    Last edited by Banfa; Aug 16 '12, 12:05 PM. Reason: Added [code] [/code] tags

    Leave a comment:


  • gayathri81
    replied to Point in polygon
    in C
    I also found that I have to convert into degrees because of latitude and logitude. So I used this:
    Code:
     double Dataprocessor::calculateDistance(const Point& a, const Point& b) 
    {
    	double lat = (a.latitude + b.latitude) / 2 * 0.01745;
    	double dLat = 111.3 * cos(lat) * (a.longitude -b.longitude);
    	double dLng = 111.3 * (a.latitude - b.latitude);
        
    	return sqrt(pow(dLat, 2) + pow(dLng, 2));
    }
    ...
    See more | Go to post
    Last edited by Banfa; Aug 16 '12, 12:04 PM. Reason: Added [code] [/code] tags

    Leave a comment:


  • gayathri81
    replied to Point in polygon
    in C
    Yes. It is also included. But I have found out where the mistake is. Thanks a lot.
    See more | Go to post

    Leave a comment:


  • gayathri81
    replied to Point in polygon
    in C
    I just modified the algorithm in Polygon.cc
    Code:
    bool Polygon::isInside(const Point& p)
     {
        int i,j= this->points.size()-1;
        bool oddnodes=false;
        for(i=0;i<this->points.size();i++)
        {
            if((this->points[i].longitude < p.longitude &&this->points[j].longitude>=p.longitude || this->points[j].longitude< p.longitude &&this->points[i].longitude>=p.longitude)&&
    ...
    See more | Go to post
    Last edited by Banfa; Aug 14 '12, 12:36 PM. Reason: Added [code] [/code] tags

    Leave a comment:


  • gayathri81
    replied to Point in polygon
    in C
    Hello Sir

    I did as you told. First made as executable statements and wrote as
    ((A!=B)&&(C*D/E)); However I found that it does not enter the function at all in the main program DataProcessor.c c(I checked this by giving some statements like hello1, hello2 etc...). Does this mean my algorithm is wrong or there is some problem in calling function in main program? Please help me out.
    See more | Go to post

    Leave a comment:


  • gayathri81
    replied to Surveillance Timer
    in C
    Hello Sir

    Thanks a lot for the idea you have given. I want the timer to run in the background and not pause the program, and the development enviroment for both GNU/LINUX and Win32.

    Will this really work?

    I heard there is something like WM_TIMER message in Win32. But I dont know if it will work for 64 bit as my server is 64 bit?...
    See more | Go to post

    Leave a comment:


  • gayathri81
    replied to Point in polygon
    in C
    I think I am making mistake in designing the polygon algorithm. This is the algorithm which I have written. Is it correct?
    Polygon.h
    Code:
    class Polygon : public Shape {
    public:
    
        Polygon(points_polygon p);
        Polygon();
        Polygon(const Polygon& orig);
        virtual ~Polygon();
    
        virtual bool isInside(const Point& p);
    
        std::vector<Point> points;
        int
    ...
    See more | Go to post
    Last edited by Banfa; Aug 14 '12, 12:35 PM. Reason: Added [code] [/code] tags

    Leave a comment:


  • gayathri81
    replied to Point in polygon
    in C
    Thanks a lot for your comments. I found out the mistake. I have edited my program and now in the process of compilation.
    See more | Go to post

    Leave a comment:


  • gayathri81
    replied to Point in polygon
    in C
    Hello Sir

    I am still not able to get sms frm polygonal geofence. As I told you, I tried to make Shape as a base class and Polygon as derived class. I have created a class called DataProcessor.c c

    DataProcessor.c c
    Code:
    void DataProcessor::run()
    {
    std::vector<Geofence> geofences= DBCon->getGeofences(deviceID);
    /*Geofence is a struct in another file by the name DataObjects.h and geofences is a object
    ...
    See more | Go to post
    Last edited by Banfa; Aug 14 '12, 12:34 PM.

    Leave a comment:


  • gayathri81
    started a topic Surveillance Timer
    in C

    Surveillance Timer

    I have designed a geofence and a sms is generated when the person leaves or enters it. Now I want that when the person is out for "x" seconds, another sms is generated telling that "person" is out for "x" seconds.

    Does anyone have idea. I searched a lot but could not get any info about it.

    I have created a field in database where the time(i.e. x) will be entered. My idea is that a timer...
    See more | Go to post

  • gayathri81
    replied to Copying value from one vector to another
    in C
    Thanks for your reply. I am trying it out. Do you mean something like this???
    Code:
    std::vector<Shape> shapes;
    
    
    Geofence::Geofence(const Shape& shapes) 
    { 
      std::vector<Shape>::iterator shapeIt = shapes.begin();
    
      for (; shapeIt != shapes.end(); shapeIt++) {
        if (shapeIt->isInside(curPosition.position)) {
          geofences.push_back(Geofence(*shapeIt));
    ...
    See more | Go to post
    Last edited by Frinavale; Aug 3 '12, 01:34 PM. Reason: Added code tags.

    Leave a comment:


  • gayathri81
    replied to Copying value from one vector to another
    in C
    Thank you for your reply. I could not exactly understand what you are telling.

    For example:
    Code:
    std::vector<Geofence> geofences;
    std::vector<Shape> shapes;
    There are some geofences saved in "geofences" . Geofence is a class. Shape is another class that has a formula to calculate distance between 2 points. Polygon is derived from Shape and Shape is base class for it.
    Code:
    std::vector<Shape>::iterator
    ...
    See more | Go to post
    Last edited by Frinavale; Aug 3 '12, 01:33 PM. Reason: Added code tags.

    Leave a comment:


  • gayathri81
    started a topic Copying value from one vector to another
    in C

    Copying value from one vector to another

    I have declared two vectors:

    std::vector<Cla ss 1> object1;
    std::vector<Cla ss 2> object2;

    object1 has some value which I want to copy in object2? Is it possible to do?
    See more | Go to post

  • gayathri81
    replied to Point in polygon
    in C
    Thank you very much . I removed the & and the error went away.
    See more | Go to post

    Leave a comment:


  • gayathri81
    replied to Point in polygon
    in C
    As you told, I made polygon as a sub class and used the algorithm below to find whether a point is inside or not.
    Polygon.h
    Code:
    class Polygon: public Shape
    {
    public:
    virtual bool inside(Point& p)
    private:
    std::vector<Point&> points;
    };
    Polygon.cc

    Code:
    bool Polygon::inside(Point& p) 
    {   
    int i, j, c = 0; 
      int nvert = poly.size();   
     for (i = 0,
    ...
    See more | Go to post
    Last edited by Banfa; Aug 14 '12, 12:40 PM. Reason: Added [code] [/code] tags

    Leave a comment:


  • gayathri81
    replied to Point in polygon
    in C
    The error got solved when I removed the keyword inline. There were 4 lines inside the braces. So I removed it and now I have solved it.
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...