Author Topic: Straight Skeletons for Roofs  (Read 22198 times)

0 Members and 1 Guest are viewing this topic.

Serge J. Gianolla

• Guest
Straight Skeletons for Roofs
« on: January 29, 2004, 11:16:20 PM »
Problem: Wanting to generate a hip roof out of a polyline with creation of ridges, valleys in plan view. Is there any bright lights around able to make sense out of the Straight Skeleton formula? Be gentle with explanations - left High School around 33 years ago! Or is there another way to approach it? Any "kick" in right direction is welcome.

Keith™

• Villiage Idiot
• Seagull
• Posts: 16899
• Superior Stupidity at its best
Straight Skeletons for Roofs
« Reply #1 on: January 29, 2004, 11:34:41 PM »
Well hello Serge .... where have you been? I'll bet you have been hanging about at the "other" place...

Seriously, though... what did you have in mind....Do you have a plan view showing the hips and ridges and want to extrude them or simply move the points into the correct z plane? Give us an example of "before" and "after" ... heck you know the drill...
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

CAB

• Global Moderator
• Seagull
• Posts: 10401
Straight Skeletons for Roofs
« Reply #2 on: January 29, 2004, 11:51:55 PM »
Hello Serge, good to see you here.
Thanks for all the help in the past.

Quote from: Serge
Straight Skeleton formula

I wish I new what you are asking. Never heard of that.

Maybe this is what you are after???

CAB

Code: [Select]
`;;;  =================================================================;;;                    HipTruss.lsp;;;  =================================================================;;;  Draws a hip assembly by picking outside corners of the end wall;;;  then pick a point on the girder side of the wall;;;  Uses current layer;;;  Based on trusses 24" o.c. and girder set back of 7 feet;;;  command: HTR;;;  command: HipTruss;;;  Overhang defaults to 24" at startup and is changed by entering o;;;  at the pick first point prompt;;;  No Error checking at this time, & ESCape exit does not save OverHang;;; ;;;    Created by C. Alan Butler  12/05/2003;;; ;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED ;;;   WARRANTY.  ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR ;;;   PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED. ;;; ;;; (setq OverHang 24) ; default value left in active drawing session;;;  =================================================================(defun c:HipTruss (/ usercmd     useros La    Ra    pt   p1 p2    p3    p1a   p1b p1c   p1d   p1e   p1g p2a   p2b   p2c   p2d p2e   p2g   loop   oh ha    ha2   la   ra hsb   90a   18a   270a usrprmpt    pj   jd hsb  );;;  =================================================================;;;                    Subroutines follow;;;  =================================================================  (defun revang (a) ; returns the opposit angle sent    (if (>= a pi)      (- a pi)      (+ a pi)    )  )  (defun line (pt ang dist)    ;;  draw a line from pt @ ang for distance    (command "_line" pt (polar pt ang dist) "")  )(defun *error* (msg)  (if    (not      (member msg '("console break" "Function cancelled" "quit / exit abort" "")      )    )     (princ (strcat "\nError: " msg))  ) ; if  (setvar "CMDECHO" usercmd)  (setvar "osmode" useros)    (princ)) ;  ;end error function ;;;  =================================================================;;;                       Main Routine;;;  =================================================================  (setq usercmd (getvar "CMDECHO"))  (setvar "CMDECHO" 0)  (setq useros (getvar "osmode"))  ;;  loop until user presses Enter or Escape or picks a point  (setq loop T oh   overhang  )  (while loop    (setq usrprmpt   (strcat     "\nSelect Building corner or O to change Overhang: "     (rtos Oh 2 2)   )    )    (setvar "osmode" 175)    (initget 6 "Oh")    (setq p1 (getpoint usrprmpt))    (cond      ((= p1 nil) ; user pressed enter       (quit) ; exit       )      ((= p1 "Oh") ; get new overhang       (initget 7) ; no error checking       (setq oh (getreal "\nEnter new overhang distance: ")     overhang oh)      )      (T ;point entered       (setq loop nil) ; exit loop      )    )  ) ; end loop  (if (not(setq p2 (getpoint "\nSelect opposite corner")))    (exit)  )  (setvar "osmode" 0)  (if (not(setq p3 (getpoint "\nSelect Girder Side of wall.")))    (exit)    )  (setq ha (angle p1 p2)) ; Hip Angle  (setq 90a  (* 0.5 pi) 180a pi 270a (* 1.5 pi) hsb  84 ; Hip Set Back 7'  )  (if (> ha pi)    (setq ha (- ha pi)  pt p1  p1 p2  p2 pt    )  ) ; endif  (cond    ((< (angle p1 p3) ha)     (setq Ra (if (< ha 90a) (- (* pi 2) ha) (- ha 90a)      ) ; endif     )    ) ; end cond3    ((< (angle p1 p3) (+ ha pi))     (setq La (+ ha 90a)) ; Left Angle, Girder to left    ) ; end cond2    (T     (setq Ra (if (< ha 90a) (+ ha 270a) (- ha 90a)      ) ; endif     )    ) ; end cond3  ) ; end cond  (if Ra ; reverse all angles & points    (setq La Ra  Ra (revang La)  ha (revang ha)  pt p1  p1 p2  p2 pt    )    (setq Ra (revang La))  ) ; endif  (setq ha2 (revang ha) ; reverse of hip angle ; interset of hip kack & girder P1a (polar (polar p1 ha hsb) la hsb) ; calc interset point of hip rafters and hip jack P1b (polar (polar p1 ha (- hsb 24)) la (- hsb 24)) P1c (polar (polar p1 ha (- hsb 48)) la (- hsb 48)) P1d (polar (polar p1 ha (- hsb 72)) la (- hsb 72)) P1e (polar (polar p1 ha2 oh) ra oh) P1g (polar p1a ha2 (+ hsb oh))  )  (command "undo" "begin")  (command "_line" p1a p1e "") ; hip rafter  (line p1g ha (+ (distance p1 p2) (* oh 2))) ; girder  (line (polar p1g La 2) ha (+ (distance p1 p2) (* oh 2))) ; show girder as 2 lines ; draw rafter jacks  (line p1a ra (+ hsb oh))  (line p1b ra (+ (- hsb 24) oh))  (line p1c ra (+ (- hsb 48) oh))  (line p1d ra (+ (- hsb 72) oh))  (line p1b ha2 (+ (- hsb 24) oh))  (line p1c ha2 (+ (- hsb 48) oh))  (line p1d ha2 (+ (- hsb 72) oh)) ; interset of hip kack & girder  (setq P2a (polar (polar p2 ha2 hsb) la hsb) ; calc interset point of hip rafters and hip jack P2b (polar (polar p2 ha2 (- hsb 24)) la (- hsb 24)) P2c (polar (polar p2 ha2 (- hsb 48)) la (- hsb 48)) P2d (polar (polar p2 ha2 (- hsb 72)) la (- hsb 72)) P2e (polar (polar p2 ha oh) ra oh)  )  (command "_line" p2a p2e "") ; hip rafter ; draw rafter jacks  (line p2a ra (+ hsb oh))  (line p2b ra (+ (- hsb 24) oh))  (line p2c ra (+ (- hsb 48) oh))  (line p2d ra (+ (- hsb 72) oh))  (line p2b ha (+ (- hsb 24) oh))  (line p2c ha (+ (- hsb 48) oh))  (line p2d ha (+ (- hsb 72) oh)) ; draw jacks  (setq jd (- (distance p1a p2a) 24)); jack distance  (setq pj (polar p1a ha 24)) ; pointer Jack start  (while (>= jd 2)    (line pj ra (+ hsb oh))    (setq pj (polar pj ha 24)) ; move over 24"    (setq jd (- jd 24))  )  (*error* "") ; call error routine to restore variables  (command "undo" "end")) ; end dfun HipTruss(prompt "\nHip Truss Loaded, enter HTR to run.")(princ)(defun c:HTR ()  (c:HipTruss))`
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Anonymous

• Guest
Straight Skeletons for Roofs
« Reply #3 on: January 30, 2004, 12:24:03 AM »
Ciao Keith, CAB and all others too numerous to enunciate...
Yeah, we had a major relocation of office with all the disruption of Xmas period, etc... so disappeared and when resurfacing mamma mia what a change at cadalog.
Simply 2D and plan view [like roof plan], and a user selects a polyline defining say the eaves line of building and the routine works out ridges, valleys, ridge line for a hip roof. Had a look at the straight skeleton formula, but j'y pige que pouic \$&# [excuse my french]!
Hope this make more sense.

P.S: is this the place to hang out?

CAB

• Global Moderator
• Seagull
• Posts: 10401
Straight Skeletons for Roofs
« Reply #4 on: January 30, 2004, 12:50:35 AM »
Serge,

Oh, that would be nice to have.
Some of the houses I'm working on have 3 to 5 different plate heights
and it makes my head hurt trying to figure out how everything ties
together. Roof's are one of my week spots, well maybe  I should say
one of my many weak spots.

CAB

PS Yes the Swamp community is growing like wild fire.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

• Global Moderator
• Seagull
• Posts: 10401
Straight Skeletons for Roofs
« Reply #5 on: January 30, 2004, 08:35:52 AM »
Serge,

Could not find any info on "Straight Skeleton formula"
Could you post it of provide a link?

CAB
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Serge J. Gianolla

• Guest
Straight Skeletons for Roofs
« Reply #6 on: January 30, 2004, 07:16:16 PM »

CAB

• Global Moderator
• Seagull
• Posts: 10401
Straight Skeletons for Roofs
« Reply #7 on: January 31, 2004, 01:02:23 AM »
Serge,

Wow, to much math for me.
Interesting though.

Here is the thing, in 2D the ridges & valleys are 45 deg or bisecting the angle.

So I have thought about it and I think the roof skeleton can be drawn.
Here is the pseudo code.

Code: [Select]
`Get a plineVerify that it is closedGet the point list of the pline add number index ((1 point)(2 point))foreach point  get the points to both sides  get the bisecting angle  place a point some distance from the vertex on the bisecting angle  if point is not in the polygon     change bisecting angle 180 deg  draw a new_line from vertex at bi-angle some distance  extend line to pline  add new_line to new_line_list  (1 newLineEnt)(2 newLineEnt)end foreachcopy new_line_list to unused_linesstep through new_line_listget 2 adjacent new_linesif they intersect  entmod the endpoints to the intersect point  add intersect point and 2 lines to point_list (point ent1 ent2)  remove new_lines from unused_lines listcontinue to next new_lineat this point all of the single hips are drawnstep through point_listdraw a ridge_line from point at bisect angle and away from hipextend this new ridge_line to plineif ridge_line intersects new_line right of hip [note hip has two vertex]  if intersect point is midpoint of that right of hip line     [entmod endpoints of both lines to intersect point     add intersect point to 2line_node list     remove new_line from unused_lines list]if ridge_line intersects new_line left of hip [note hip has two vertex]  if intersect point is midpoint of that left of hip line     [entmod endpoints of both lines to intersect point     add intersect point to 2line_node list     remove new_line from unused_lines list]At this point major ridges & valleys are drawn`

I think all that is left to do is connect the 2line_nodes which will be
the minor ridges connecting ridges of differing heights.

Haven't worked that out yet but too tired to continue today.

Hope this makes sense in the morning.

What do you think?

CAB
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Serge J. Gianolla

• Guest
Straight Skeletons for Roofs
« Reply #8 on: February 02, 2004, 06:07:40 PM »
Hey C. Alan,
Thanks for pointers. Trouble is, the coding for a ridge or valley is relatively easy for conventional roofs; but as soon as you go out of ordinary, the complexity of working the minor ridge lines and major one gets harduous [visually it is simple] but mathematically... See attached image, where I went bersek to draw outline. The magenta dots are lengthy to calculate but nevertheless feasible to achieve, as for the rest storing pts in memory is not enough to decide of the correct layout. This is where the formula comes in handy, and I really thought that it would be easy to break it down in simple steps in plain english. What I need to find is someone fresh out of uni to explain that in laymans' terms!

Uhmm! How d'ya attach a bloo..dy image?

CAB

• Global Moderator
• Seagull
• Posts: 10401
Straight Skeletons for Roofs
« Reply #9 on: February 02, 2004, 06:22:34 PM »
Images must be stored Here
Then you copy the link & put the link as a Img.

At least that is the way I am doing it.

CAB
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Serge J. Gianolla

• Guest
Straight Skeletons for Roofs
« Reply #10 on: February 02, 2004, 06:33:07 PM »

CAB

• Global Moderator
• Seagull
• Posts: 10401
Straight Skeletons for Roofs
« Reply #11 on: February 02, 2004, 06:38:54 PM »
Sorry I should have said copy the link when you view the picture.

I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Serge J. Gianolla

• Guest
Straight Skeletons for Roofs
« Reply #12 on: February 02, 2004, 06:42:19 PM »
Muchas gracias amigo, I was going loco!
Maybe you can help with some weird thing too. Even though when I login I every time say automatically log me in, it does not remember who's around!!

CAB

• Global Moderator
• Seagull
• Posts: 10401
Straight Skeletons for Roofs
« Reply #13 on: February 02, 2004, 07:02:19 PM »
Now that is a funky roof.

I thought the algorithm could handle the circle points, the Ridge line part, but the oval area is a bit much. I think you need to redesign the house.

Perhaps Keith or Daron can help you with the login problem.