TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Serge J. Gianolla 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.
-
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...
-
Hello Serge, good to see you here.
Thanks for all the help in the past. :)
Straight Skeleton formula
I wish I new what you are asking. Never heard of that.
Maybe this is what you are after??????
CAB
;;; =================================================================
;;; 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)
)
-
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?
-
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.
-
Serge,
Could not find any info on "Straight Skeleton formula"
Could you post it of provide a link?
CAB
-
Hi CAB,
Find a coupla' links to help.
http://compgeom.cs.uiuc.edu/~jeffe/pubs/cycles.html
http://www.sable.mcgill.ca/~dbelan2/roofs/roofs.html
Thanks for any input.
-
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.
Get a pline
Verify that it is closed
Get 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 foreach
copy new_line_list to unused_lines
step through new_line_list
get 2 adjacent new_lines
if 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 list
continue to next new_line
at this point all of the single hips are drawn
step through point_list
draw a ridge_line from point at bisect angle and away from hip
extend this new ridge_line to pline
if 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
-
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!(http://)
Uhmm! How d'ya attach a bloo..dy image?
-
Images must be stored Here (http://www.theswamp.org/lilly.pond/)
Then you copy the link & put the link as a Img.
At least that is the way I am doing it.
CAB
-
(http://www.theswamp.org/lilly.pond/index.php?subdir=public&sortby=name&msg=%3Cp%20class%3Dinfo%3EUpload%20of%20file%20Roof.bmp%20succeeded)
-
Sorry I should have said copy the link when you view the picture.
(http://www.theswamp.org/lilly.pond/public/Roof.bmp)
-
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!!
-
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.
I think Mark is asleep about this time. :)
(http://www.theswamp.org/lilly.pond/CAB/Roof2.jpg)
-
Yeah, obviously I did the "almost" weirdest shape that I could conceive at the moment to illustrate - but you know it is bound to happen in real life! And we are not even talking about when part of the roof is circular a la Tuscany tower... A routine should be able to handle as many cases as Architects have ... creativity.
-
I see it would be difficult to accommodate most of the possibilities.
Plus you are not dealing with varying plate heights in this scenario.
I came up with an alternate tie in for the roof. But it didn't help.
The way I deal with the skeleton with complex roof is to use the
roof command in ArchT, this creates 3D roofs. Then view them shaded.
I can then trace where the roof planes intersect. In this way i deal with
varying plate heights.
(http://www.theswamp.org/lilly.pond/CAB/Roof3.jpg)
-
This is how it looks for me.
If i find another method I'll let you know.
(http://www.theswamp.org/lilly.pond/CAB/Roof4.jpg)
-
Well, I am not the sharpest tack in the roof design area, but from the looks of the roof, you will need to either.
1. Change the ovaled area from a hip to butting gables
or
2. Extend the ridge in a similar manner as the left version of the roof.
Now, as I look at the section on the left, there is absolutely NO WAY that will work as it is drawn. There will have to be an additional valley AND ridge to get it to work.
Cab, I took the same thing you had and applied a 6/12 to the entire roof section in a solid model and the results were exactly the same. So...
Who knows what to do in this particular situation.
-
OK guys,
This roof concept layout does not exist! Maybe I was not obvious enough, when I said I went bersek to draw outline I drew the most stupid shape to illustrate what I wanted to convey to CAB. Nowhere and no way that you'd design this. But again there are no garantees that some similar layout will not crop up, and my point was that the formula would work in most [may be all instances], because it basically "offsets" the outline to its simplest element and the result is a straight skeleton.
I am not after someone to write the code, only interested in understand the formula.
Thanks
-
Sorry, it was me and I was logged in! WEIRD!!
-
Well, ultimately if you develop a program, you would like for it to solve even the most complex of things. after all, isn't that WHY we write programs, to solve complex problems (and every now and again to do a few simple menial tasks too)
-
Serge,
I was just comparing my actual methods to the process to get ideas
about how to program a solution.
I took the same thing you had and applied a 6/12 to the entire
roof section in a solid model and the results were exactly the same.
So... Who knows what to do in this particular situation.
In this situation I would lower the pitch on the left side to match the
center ridge line and I think it would work out that way.
But, as Serge said he was giving a worst case example of what the routine
would have to deal with. Turns out Serge has a good imagination.. :)
Doesn't seem reasonable that you will get a fool proof "one Click" solution
by selecting the roof outline. I do see that a routine could give you a
"Best Guess" skeleton and the user would have to tweak it.
CAB
-
I know you could make it work with no problems by making the ridge on the 3 main sections meet. This would indeed solve the problem, but a roof with 3 different pitches is not the most attractive in the world. Of course this does not mean it won't work, just that it will not look the best.
-
differing pitches might control it, but that'll make any code a bit more complex too.
-
Does anyone think of the poor contractor that's gonna make this? :)
-
Well we are getting off track here.
The example was one Serge made up to test worst case,
not intending to actually design or build it.
Keith and I were having a bit of fun with trying to make
the roof actually work. :)
That aside, Serge was trying to see if one could pick a
closed lwpolyline and have a routine draw the roof
skeleton 2D in plan view. Provided all roof sections are
hips, same pitch and at the same plate height.
It appears to be a difficult task.
Any ideas?
CAB
-
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!!
What browser(s) are you using, IE, NN, Mozilla, etc.? Do you use more than one?
-
What browser(s) are you using, IE, NN, Mozilla, etc.? Do you use more than one?
One, nothing out of ordinary, just XP Pro IE.
[/quote]
Do you have your internet options set to accept cookies?
-
Yea, that was a wardrobe malfunction alright. My A$.
I was awake for both of those. :shock:
I would like to see the horse commercial again though.
CAB
-
Maybe it is time to revive this dead horse for a good floggin'. After all with the new blood in past few months, hopefully one of the new members will have a stroke of genius :o
-
would be good if it happened... I have seen the need for such a routine in recent months...
-
Once I finish my new arcdraw objectarx project.... I will give this a try.
I did not read all the previous posts... but we can draw the roof automatically [normal shapes] if we use a closed polyline, extrude, with a large height and 45 as an angle of taper....
-
I hope Serge is still interested in this one.
But if not i am.
You know, I still have my notes & pseudo code on my desk as we speak.
Could not file it away just yet. Only been a year :-)
-
Here are two commands to run some tests:
TST1 and TST
It has an offset distance of 0.5
For now, it will require the selection of some of the resultant polylines, and maybe one of these days to come up with the other part [to connect all the points to draw the valleys and crests]
The commands are compiled as FAS.
Have fun.
-
Here is a demo image:
-
Yes CAB, still definitely IN TE RE ST ED :lol:
Luis, I tried your FAS file, and for a while nothing appears to happen - I realised why, we work in metric and when using offset distance of 0.5 for us it is 1/2 mm! Maybe a better value of 50mm at this stage, then can be refined, and possibly checking variable MeasureInit to see if dwg is in imperial or metric.
P.S: this got you hooked, didn'it? :-D
Ta
-
P.S: this got you hooked, didn'it? :-D
Ta
:-)
That, was a quick solution.... let me make some minor changes and I'll posted back..... as soon I can.
-
Luis
I assume you have a plan in mind to actually draw the skeleton.
Connect the dots so to speak. :-)
-
Luis
I assume you have a plan in mind to actually draw the skeleton.
Connect the dots so to speak. :-)
Hi Charles,
The first, try was exactly that.... for example, on what I did on GBPoly the entities are there, and a geometry engine can follow the graphical structure... to find all the possible loops.
Here, is different, we have a closed area, that requires to smash or have a collision to the geometric center or at an internal point.
By looking on the demos applet's that's what they are doing..... maybe instead of creating all the internal loops.... just find the vector direction, that's is created from the intersections..... the problem with this is how to tell the vector to turn.
That [the turn] is the hard part.....
So, if we can simple generate those internal loops.... none graphical ... grab those points, connect them [not to hard].... I think would work.
-
maybe instead of creating all the internal loops.... just find the vector direction, that's is created from the intersections..... the problem with this is how to tell the vector to turn.
That [the turn] is the hard part.....
So, if we can simple generate those internal loops.... none graphical ... grab those points, connect them [not to hard].... I think would work.
That was my approach to the solution, but a year ago I did not have the programing skill to make it happen. I think today I may have a chance at it.
My thought was to go from vertex to vertex around the closed pline.
Working with 3 vertex at a time, find the bisecting angle to create an imaginary line for the center vertex.
Then move to the next vertex & get that bisecting angle & line, continue till all are in a list.
The process this list, finding all the intersect point of lines that are next to each other.
Ignore lines that are not from an adjacent vertex.
Then looking at the lines next to each other pick the intersect point that produces the shortest distance from the original vertex.
Remove any point in the list that produces a too long condition.
Then from the new list of points bisect the angle of the new line intersects which would give you the ridge lines.
Extend the new ridge lines out until they intersect with an adjoining original bisect line.
Well it's getting complicated at this point and that was my though a year ago.
-
Yes, we are in the same boat.... I almost finish what I am doing for arcdraw.... I am going to leave the MFC dialog, for the next days.... and would try to do something on this....
[Lately I have a hard time to open some of my code..... as you and other have noticed...]
-
This baby needs a blood transfusion to revive.
Please donate generously.
-
I'm not trying to be a smart a$$ but my donation would be "move to ADT". It has this functionality already.
-
Will, Will, Will,
Many Architectural draftsmen are working from home, all over the world and cannot afford ADT. So offering a cheaper package would benefit them.
It has this functionality already.
Otherwise stop 80% of the coding posted here because it is built-in somewhere. :-D
-
:pissed:
:-)
-
< .. snip ..> Otherwise stop 80% of the coding posted here because it is built-in somewhere. :-D
^^ what he said !
innovation IS critical.
-
This topic was very interesting? What ever happened to this anyway?
-
It proved too difficult for me at the time. I think I could now do the flat version I proposed, but it was a limited solution at best. That is it would only work for single plate height roofs.
-
It proved too difficult for me at the time. I think I could now do the flat version I proposed, but it was a limited solution at best. That is it would only work for single plate height roofs.
I was trying to find a program like this back is 2005 to use it at work. Maybe someday it could get completed.
Thank you,
Brad
-
It proved too difficult for me at the time. I think I could now do the flat version I proposed, but it was a limited solution at best. That is it would only work for single plate height roofs.
Cab,
could you post what you have. I would like to see how it works.
-
No, because it doesn't work. :-)
What I have is 545 lines of code in the development stages from 2004.
The debugging had just begun and looking back at the code there are many things I would change
just because of the knowledge I have gained over the years.
The code is too raw for me to post and without knowledge of the code and lack of commenting only an
experienced programmer could figure it out.
-
No problem Cab, I understand.
-
Cab,
Take a look at this link to help you with your program.
http://www.cgal.org/Manual/3.2/doc_html/cgal_manual/Straight_skeleton_2/Chapter_main.html
-
Clear! (thump) Here's my donation so far...though it's just a bloated offset routine just yet...
(defun loff (pt od)
(setq ang (angle (car pt) (cadr pt)))
(list (polar (car pt) (+ ang (/ pi 2)) od) (polar (cadr pt) (+ ang (/ pi 2)) od)))
(defun witio (lin1 lin2 intb)
(inters (car lin1) (cadr lin1) (car lin2) (cadr lin2) intb)
)
(defun lpfm (lin1 dir)
(setq mp (polar (car lin1) (angle (car lin1) (cadr lin1)) (/ (distance (car lin1) (cadr lin1)) 2)))
(setq ep (polar mp (+ (angle (car lin1) (cadr lin1)) (* (/ pi 2) dir)) 2000))
(list mp ep))
(defun c:skel ()
(setq iter (getint "Number of iterations: "))
(setq roof (entget (car (entsel "\nSelect roof outline:"))))
(setq rv '())
(setq n -1)
(repeat (length roof)
(setq n (+ 1 n))
(if (= (car (nth n roof)) 10)
(setq rv (cons (cdr (nth n roof)) rv))
)
)
(setq re '())
(setq n -1)
(repeat (length rv)
(setq n (+ 1 n))
(if (= n (- (length rv) 1)) (setq re (cons (list (nth n rv) (nth 0 rv)) re)) (setq re (cons (list (nth n rv) (nth (+ 1 n) rv)) re)))
)
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(vla-EndUndoMark ActDoc)
(vla-StartUndoMark ActDoc)
(setq osm (getvar "osmode"))
(setvar "osmode" 0)
(setq n -1)
(setq ra '())
(repeat (length re)
(setq n (+ n 1))
(setq m n)
(setq as T)
(repeat (length re)
(setq m (+ m 1))
(if (> m (- (length re) 1)) (setq m 0))
(if (= m n) (setq m (+ 1 m)))
(if as (progn
(if (witio (lpfm (nth n re) 1) (nth m re) T) (setq as nil ra (append ra '(1))))
(if (witio (lpfm (nth n re) -1) (nth m re) T) (setq as nil ra (append ra '(-1))))))
)
)
(setq o 0)
(repeat iter
(command "_pline")
(setq n -1)
(setq o (+ 1 o))
(repeat (+ (length re) 1)
(setq n (+ n 1))
(if (= n (- (length re) 1)) (setq m 0) (setq m (+ n 1)))
(if (= n (length re)) (setq n 0 m 1))
(command (witio (loff (nth n re) (* o (nth n ra))) (loff (nth m re) (* o (nth m ra))) nil))
)
(command "")
)
(vla-EndUndoMark ActDoc)
(setvar "osmode" osm)
(princ)
)
-
Eric,
Welcome to TheSwamp. :-)
-
Thanks, Cab :)
Did you go that page with the java applet showing how it calculated the roofs? Wowsa. That's amazing stuff. I seriously see it being possible in LISP. But I've got a question for the lot of ya.
In my function, I collect all the vertices, then create a list of all the edges using the vertices. Then I take each edge and check which direction a perpendicular line from the midpoint intersects another edge and use that direction as the interior of the shape. It works ok for simple roof shapes, but eats dirt on concave type shapes that would have an intersection both ways. Like I said before, I'm pretty green in LISP and haven't figured a better way yet. Any ideas?
-
Yes there are some cool links with great demo's.
My only possible solution was this http://www.theswamp.org/index.php?topic=721.msg100264#msg100264
LE's example used the perimeter as a polyline & then offset to the inside.
Not sure of your question though. Perhaps a picture, if you can post one.
In the Reply screen you will see "Additional Options", click it & it will allow you to upload a photo or DWG.
See Ya.
-
Ok, I've spent the last few nights laying awake in bed running through an algorithm for this. In my head it works. :-P
Collect vertex points
Define the bisector line for each vertex, calling each bisector a tier 1
Recursively loop through function:
Loop through the bisector lines to find the shortest intersection with another bisector
- With the shortest bisecting line, check to see if other bisectors intersect at the same point
- If at least one line intersects at that point, draw all lines that intersect and remove bisectors from list
- If no other lines intersect, check tier of bisectors
+ If tier 1s then create new bisector line using the angles of the two, and define as a tier 2
+ If tier 1 and 2 bisect (should be a ridgeline with a hipline or something), check the angle of intersection
| If < 90 mirror the tier 1 across a line 90deg from tier 2
| If > 90 mirror the tier 1 across the tier 2 line
+ If two tier 2's bisect, it should be far enough into the routine to be finding 3 or more lines intersecting at the same point
+ Remove intersecting bisectors from list
- Check the length of list against the length before above code and see if list is shorter; if not report error and exit
- Call back into self with new list
:?
Lost yet? I've got the base code for it, I just need to write the recursive function (ie - the hard part). I'm kinda itchy to see what it will return when I run it. Of course, single plate height will be the issue here, but you people should be able to modify the outcome to your needs. :evil:
-
Yes there are some cool links with great demo's.
My only possible solution was this http://www.theswamp.org/index.php?topic=721.msg100264#msg100264
LE's example used the perimeter as a polyline & then offset to the inside.
Not sure of your question though. Perhaps a picture, if you can post one.
In the Reply screen you will see "Additional Options", click it & it will allow you to upload a photo or DWG.
See Ya.
BTW, Here it is an animated image showing the latest done in arx... it just needs some minor corrections :)
-
Cool. :-) Mine is nowhere near that good. I've got basic shapes down, but it craps out on complex ones. How are you determining your intersections and the resulting lines?
-
I've got basic shapes down, but it craps out on complex ones.
Do not think that AutoLisp it is a good choice for this, but many times I have been wrong.
How are you determining your intersections and the resulting lines?
Most of what I implemented here it is part of my own geometry classes done in C++/ARX, not exposed to the public.
There are so many pseudo codes or algorithms, out there, the one posted in a URL link previously here it is a good start.
http://www.cgal.org/Manual/3.2/doc_html/cgal_manual/Straight_skeleton_2/Chapter_main.html
Have fun.
LE!
-
... it just needs some minor corrections :)
Here is another correction, but still needs more debugging....
-
That's quite good Luis.