For the walls, its based on clicks. First click sets the first corner, second click the second corner etc until you have a closed shape room. Center of the box is the click location.
The tubes are just connecting the corners.
I didnt implement the windows yet but I am thinking it will be drag n drop.
See how on the green arrow, you cannot place a window on that black box. Its not a space available on the inside dimensions of the room.
And on the red arrow you can because its on the inside dimension of the room.
Does the thickness of the black lines represent the thickness of the walls to be built? If so you cannot place a window at the red arrow since it overlaps a wall!!?
Yes you are right about that! I made a mistake there. But the issue still persists because as it is the window would be positioned like the red arrow on all corners.
Just a suggestion. Once the user has clicked on all the corners make an assumption that lines joining the corners form the inner walls of the room. Take any of the lines L joining two corners and when drawing the tubes of radius R for L add +R or -R to the points forming L. in the direction of the normal to L. Plus or minus depending of the relative position of the line to the center of the room.
A simple case let L define a wall of thickness T (radius R = T / 2) where L has length 200 with corners (0, -100) and (0, 100) and is a right hand wall. The the path line, P, for the tube is from (R, -100) to (R, 100).
Now take a window of length W with its center C (R, y) on the path line P, then the constraints for y are
y - W/2 > -100 and y + W/2 < 100
Bit more fiddly if line is an angle but just as doable.
True in 3D but your house plan is 2D so only two normals one the negative of the other.
When p0 and p1 are two points (position vectors) on a line then t = p1 - p0 will give a vector along the line from p0 to p1 and the vector (-t.y, t.x) will be one of the normals. You then have to decide which is pointing to the outside. For a usual 2D axis system with p0, p1 in counter clockwise order and t = p1 - p0 the the normal needed is (ty, -tx)
angleDirectionStart/End:
Why take only the y value from the unit vector?
I see that the resulting values are 1, -1, or 0.9999999999999999. What does each value mean? Its a bit hard for me to visualize the direction of an angle.
I can see later that we use this to determine if the corner is reversed(internal reflex angle)?
That is its purpose should be 1 or -1, 0.9999999999 is a lack of precision because floating-point needed, close enough.
On mobile so cannot draw a diagram and it is hard to explain without one. Basically for any size corner angle it adds the needed offset parallel to the line to position the outer corner point