Trying to make life worth

Sunday, December 30, 2018

How to determine whether the two Bounding boxes intersect or not ?

Let's assume we two Bounding Box A and B.  Proof is by contradiction. Any one of four conditions guarantees that no overlap can exist:
  • Cond1. If A's left edge is to the right of the B's right edge, - then A is Totally to right Of B
  • Cond2. If A's right edge is to the left of the B's left edge, - then A is Totally to left Of B
  • Cond3. If A's top edge is below B's bottom edge, - then A is Totally below B
  • Cond4. If A's bottom edge is above B's top edge, - then A is Totally above B
  • Cond5. If A's front edge is below B's bottom edge, - then A is Totally below B
  • Cond6 If A's back edge is above B's top edge, - then A is Totally above B
So condition for Intersect is
Cond1 && Cond2 && Cond3 && Cond4 && Cond5 && Cond6
Intesect Consdition: ((b_xmax >= a_xmin) && (b_xmin <= a_xmax) &&
            (b_ymax >= a_ymin) && (b_ymin <= a_ymax) &&
            (b_zmax >= a_zmin) && (b_zmin <= a_zmax))

How to Visit Lansdowne ?

I visited Lansdowne with my wife on 5th October by train(14041 MUSSOORIE EXP 22.25PM Friday ) from Old Delhi Railway station(Nearest Metro Station Chandi Chowk) to Kotdwara(Nearest Railway station of Lansdowne). I reached in the morning around 7 Am and took a sharing Bolero (Each person 80rs) to reach to the city market of Lansdowne.
After reaching Lansdowne we had breakfast at one local restaurant then we headed towards Bhulla Tal lake (Around 1 km from Lansdowne city market) on foot. Ticket of Bhulla Tal lake is 20rs per person. We took many pics and enjoyed the peaceful environment there.
Then we move toward our resort Tip n Top (1.5 Km on foot). on the way, we visited St. Mary’s Church. After reaching resort we took some rest and freshen up ourselves then we ate Maggi and omelet at Maggi point outside of Tip N Top resort. Maggi and omelet were awesome. Then we enjoyed the Tip N Top point really awesome resort and hill. then in the next morning, we enjoyed the sunrise with a hot cup of tea and after getting ready we came down in the city market around 9oclock and then we went on foot to Bhim Pakoda around 2 km from the city market. The journey is worth than a destination of Bhim Pakoda. then we came back around 12 in the afternoon and had tea on Dhaba. then we hired a small car (1200rs from and to ) for Tarakeshwar Mahadev Temple. Again way to reach Temple is awesome it is worth to spend 1200rs. then came back around 5 o'clock and reached Kotdwara Railway station by passenger Bolero(Same 80rs per person). then wait for Train till 10:30 in the Waiting room.
then Reached Delhi in the morning(8:30 Am) by train (24042 MUSSOORIE EXP)
Recommendation :
  1. Book Tip n Tip Resort in 2700rs by website Garhwal Mandal Vikas Nigam Ltd. it is worth you will stay on the Top point where people came to visit for 1 hour and you will stay there for Night and you will Enjoy sunrise and sunset. it is an awesome resort and try to take Yellow Hut ( Hut Number 101 and 102).
  2. Visit Tarakeshwar Mahadev temple first Day After Reaching Resort and bath come back to City market and Hire Cab.
  3. Book Return Ticket (14043 GARHWAL EXPRESS 15.30 ) so no need to wait in Night for 10:30 PM train.

Monday, July 24, 2017

Surprise . (Dot) in Gmail Id is not consider

Hi, Now a day Everyone has Email id with the different name like bhakar.(dot)38@gmail.com, bhakar.(dot)churu@gmail.com, bhakar.(dot)239@gmail.com etc. Have you ever notice that there is no meaning of  "." (Dot) in your email Id. You can log in without "."  (dot) like bhakar38@gmail.com. 
One Day I was trying to log in my Gmail id and My email id is bhakar.churu@gmail.com. I entered bhakarchuru@gmail.com and type password. It successfully log in. I noticed I forget to type "." (Dot) but its login

Enjoy without "." in your email id. 

Wednesday, December 14, 2016

How to Find Minimum Area Bounding Rectangle for given 3D Polygon ?

I have an arbitrary polygon as shown in Pic with co-planar Vertices's A,B,C,D,E,F,G,H in 3 D coordinate System. This Polygon is about to arbitrary axis.
Step 1. Rotate Arbitrary Polygon in X-Y Plane[Bounding-rectangle of 3D Polygon]
Step 2. Pick 1 edge and align this edge with the X axis(use Destination Vector " Vector3(1, 0, 0); // X-axis for align Edge Along X-axis " and Edge Direction as Source Vector. Compute Rotation Matrix and Save as EdgeAlignX-Axis Matrix to Rotate back Rectangle in Step 4). Use the min/max x,y to find the bounding rectangle. Compute Area and store in list, Do the same for remaining edges in  polygon. Pick the rectangle with the minimum Area.

Step 3.  Generate Minimum Bounding Rectangle by using min max.
bottomleftCorner = new Vector3(minXYZ[0], minXYZ[1], pointarr[0].z);
bottomRightCorner = new Vector3(maxXYZ[0], minXYZ[1], pointarr[0].z);
topLeftCorner = new Vector3(minXYZ[0], maxXYZ[1], pointarr[0].z);
topRightCorner = new Vector3(maxXYZ[0], maxXYZ[1], pointarr[0].z);

Note:- set Z-value of Bounding Rectangle Equal to Rotated Polygon Z Value for Perfect Align. Instead of Min Z and Max Z. 
Step 4. Rotate Computed Bounding rectangle Reverse of Edge Align X-Axis Matrix.

step 5.  rotate Bounding rectangle back to Original polygon direction by using reverse of Rotation matrix.








How to find Bounding Rectangle of 3D Polygon

I have an arbitrary polygon as shown in Pic with co-planar Vertices's A,B,C,D,E,F,G,H in 3 D coordinate System. This Polygon is about to arbitrary axis. 
1.Rotate this arbitrary polygon  in X-Y Axis. 

How to rotate Polygon from arbitrary Axis to X-Y Axis.

Compute normal of given Polygon. lets Assume normal of Polygon is Vector Nsrc.
Normal for any plane in X-Y axis will Z-direction so normal for X-Y Plane Vector Ndst (0,0,1).
By using Nsrc (source normal) and  Ndst(destination Normal) compute rotation matrix and rotate plane in X-Y Axis.

2. Compute Min-Max for Rotated Polygon. i. e minXYZ[] and maxXYZ[] and generate Bounding rectangle by using min max.
bottomleftCorner = new Vector3(minXYZ[0], minXYZ[1], pointarr[0].z);
bottomRightCorner = new Vector3(maxXYZ[0], minXYZ[1], pointarr[0].z);
topLeftCorner = new Vector3(minXYZ[0], maxXYZ[1], pointarr[0].z);
topRightCorner = new Vector3(maxXYZ[0], maxXYZ[1], pointarr[0].z);

Note:- set Z-value of Bounding Rectangle Equal to Rotated Polygon Z Value for Perfect Align. Instead of Min Z and Max Z. 
3.  rotate Bounding rectangle back to Original polygon direction by using reverse of Rotation matrix.


Bounding Rectangle

Sunday, December 11, 2016

How to sort 3D vertices of a polygon in order?

we are given multiple random coplanar 3D points. Compute normal by any 3 Point. we need to rotate all these point in X-Y plane. So compute rotation matrix normal to (0,0,1). rotate all these in X-Y plane.


      double[] normal = PlaneUtils.getNormal(tverts);
      Vector3 srcNormal = new Vector3(normal[0], normal[1], normal[2]).normalize();
      Vector3 destNormal = new Vector3(0, 0, 1);
      // Rotation Matrix of Arbitrary Polygon From Current Plane to XY Plane
      Matrix4 rotationMatrix = Matrix4.rotate(destNormal, srcNormal);

      for (int i = 0; i < PointArrVal.length; i++) {
        PointArrVal[i].timesEquals(rotationMatrix);
      }

Now Compute Mean of All X-coordinate and mean of All Y-coordinate.
Mean of X= Sum of All X-coordinate/number of Point and in same way compute mean of Y.

Compute Atan2 angle between Mean Point and given coordinate.

Math.atan2(clipCornerPoint[i].y - cY, clipCornerPoint[i].x - cX), clipCornerPoint[i]
Store computed angle with vertices in Ordered Multi Map like

TreeMap <Double, List<Point3>> multimap = new TreeMap<Double, List<Point3>>();
      for (int i = 0; i < clipCornerPoint.length; i++) {
        putObjects(multimap, Math.atan2(clipCornerPoint[i].y - cY, clipCornerPoint[i].x - cX), clipCornerPoint[i]);
      }

Sort map angle as key and it will give you vertices in order.
now reverse your point in same previous Arbitrary Axis by inverse Rotation Matrix.

A habit of donation “We only have what we give.”

I started my earning(income) journey from Reliance Jio as Software Developer in 10 July 2012 on my b'day. I was happy to join company.because it is very big industry. there was one dream from College time that when  I will earn I will donate some part of my salary every month. I got my first salary in august around 22K. all of my friends and me were happy with first salary and planning to go outside for celebration and I forgot my small dream.One Sunday i was enjoying tea with my friend and i saw a beggar in Mumbai i thought for a moment and my donation dream strike in my mind. but as human nature I started giving excuse to myself  "first make yourself at some level to give donation". why should i give my hard earning money ? Beggar can also earn he also have hand blah.... But I learned one thing that It was very difficult to donate 10rs from your hard earned salary. But in the evening  I opened a Recurring deposit in my salary Account and started to save 2% of my monthly salary that was around 600rs and thus i made yearly saving of 7200rs. I donated this 7200rs  for treatment  of one old cow in my village. Then i got increment next year my salary became 40K so 2% of that was 9600 rs yearly. I bought some sport material and exercising equipments for the sport club of my village. In 3rd year 2% of my salary was 12000rs. I donated to my village Gausala. Then I switched my Job from Reliance to VizExperts Gurgaon. Now 2% of my annual income is Rs 16800. now I am thinking of donating it to a cancer patient in my village. I feel always very happy about this initiative taken by me. it is only 2% of my salary but a good amount to help someone.

“There is nothing more beautiful than someone who goes out of their way to make life beautiful for others.” 

Sunday, April 6, 2014

IIT JEE Main 2014 answer key Paper Code wise

JEE Main 2014 Was Successfully Conducted on 6th April 2014 (Offline Mode) at 150 Examination Centers all over the Country. A large No. of Candidates have Been Appeared in the Exam in Paper 1 as Well as in Paper 2. The First Paper of JEE Main was Conducted From 09:30 Am to 12:30 Am whereas Second Paper or Paper II Was Conducted From 02:00 Pm to 05:00 Pm. The Online Entrance Test of JEE Main will be Conducted on 9th|11th|12th & 19th April 2014. A lot of Candidates have Been Appeared in the Offline Exam on 6th April 2014 whereas Remaining Candidates will appear in the Online Exam of JEE Main 2014.

Candidates can Check the Answer Key Set Wise as as Set E, Set F, Set G, Set H form the Link Mentioned Below on this Page. The Answer Key of JEE Main 2014 will give you a Rough Idea to the Candidates about their Marks in the JEE Main Exam 2014. 


Coaching Institute
JEE Main 2014 Answer Key

Motion IIT-JEE