Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 13
Posts: 13   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 7173 times and has 12 replies Next Thread
bandara
Newbie




Joined: Dec 26, 2009
Post Count: 13
Status: Offline
Reply to this Post  Reply with Quote 
how to get area of room

Hi I saw this topic in earlier too, but our experts answer was get a tape and measure :)

But i really need to get the area of room to call in my plugin.
I know there is a method getArea() in Room class, but it got constructor of float [][].
i.e. Room(float[][] points)

I dont know what value should i pass into this, when create Room object before calling getArea()

Room r =new Room(s1);
float area=r.getArea();

What i should pass to s1.

Funny thing is, when we draw room, it shows area inside it, but i cant get it to my plugin. :)
[Jun 23, 2011, 2:24:22 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9426
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get area of room

No need to create a new subject.
If you're a student and want to become a serious developer, you must learn how to use an API from its documentation or its source code when available.
The Javadoc of the Room class says its constructor takes an array of coordinates as parameter, it also proposes methods to modify the coordinates of a room.
If you don't know how to interpret the documentation of a method or a constructor, you can take profit of working with an open source program and search in its source code how it's used (for example at line 2033 of the PlanController class). If you don't know how to search in the code, learn Eclipse search menu items, it will save you hours of work.

Finally, from the source code you proposed, I repeat: "since when a line has an area?".
In case you didn't get it, this was a clue to help you fix your program.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
[Jun 23, 2011, 2:47:17 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
bandara
Newbie




Joined: Dec 26, 2009
Post Count: 13
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get area of room

I got ur point, to get a area we need more than 3 points.

But i need to get the area of room which i draw in sweethome3D.
I still couldnt get that area.
Can you please give a code to get the area of room. Please sir, with out that room area i can't continue my project.
[Jul 10, 2011, 5:04:52 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
bandara
Newbie




Joined: Dec 26, 2009
Post Count: 13
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get area of room

float s1[][] = { { 0, 0 }, { 0, 4 }, { 4, 0 }, { 4, 4 } };
Room newRoom = new Room(s1);
float s2[][] = newRoom.getPoints();
Room r1=new Room(s2);
area=r1.getArea();
JOptionPane.showMessageDialog(null, area);

//this result 8.0 always, for all shapes of rooms (this 8 mean half area calculated from given s1),
But this is not what i need. I need to get the area of room which i draw in sweethome 3d.
If we have to parse values manually, what is the need of having getPoint and getArea method. Please help me in this.
[Jul 10, 2011, 7:20:39 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9426
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get area of room

Room#getArea does work correctly.
float s1[][] = { { 0, 0 }, { 0, 4 }, { 4, 0 }, { 4, 4 } };
This shape has actually an area of 8.

float s1[][] = { { 0, 0 }, { 0, 4 }, { 4, 4 }, { 4, 0 } };
This square shape has an area of 16.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
[Jul 11, 2011, 12:38:36 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
bandara
Newbie




Joined: Dec 26, 2009
Post Count: 13
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get area of room

yep, tx on that sir,

But this not return the area of room that i draw in sweethome 3D, it return 16 always. Check this image link
http://www.image-share.com/ijpg-768-257.html

Although i draw 127.16 sized room, this return 16 only. I think when creating a object of room, the value we parse through constructor will effect on getArea method.
If so, how can i get that 127.16 (or actual drawn value)
Please sir, help me on this.
[Jul 11, 2011, 3:21:03 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9426
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get area of room

You probably didn't request the area of the displayed room.
By the way that internal values are always expressed in centimeter.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
[Jul 11, 2011, 3:49:45 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
bandara
Newbie




Joined: Dec 26, 2009
Post Count: 13
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get area of room

Sir, do i have to use any actionListners to do it, or is there any other class/object that i have to create, before calling getArea.
I'm confusing, how that real values, come to method when calling it.
I "sout" getPoints using "for" loop, but it returned values which i call when create object of Room (i.e. float s1[][] = { { 0, 0 }, { 0, 4 }, { 4, 4 }, { 4, 0 } };)

So, can you please tell me how can i request the area of the displayed room.
[Jul 11, 2011, 2:44:28 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
bandara
Newbie




Joined: Dec 26, 2009
Post Count: 13
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get area of room

Sir, can you tell me factory reference class for
getArea() -> to get the area of the room

Because my supervisor told me that, there should be a class which reference the value for Room class.

Thanx.
[Jul 12, 2011, 4:08:17 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9426
Status: Offline
Reply to this Post  Reply with Quote 
Re: how to get area of room

Sorry, I don't know what you mean by "factory reference class".
Even Google wouldn't know!!!
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
[Jul 13, 2011, 4:27:42 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 13   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

  Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads  
© Copyright 2024 Space Mushrooms - All rights reserved