I have a graph that is divided has 3 different quadratic curves, these
curves divide my graph into 4 zones ie zone 1 zone 2, zone 3 and zone
4, Two of these curves stop and become vertical lines. Refer to
http://www.zodm.com/images/gSB67318.pdf
for a drawing of my graph.
What I am trying to do is define these 4 different zones mathmatically.
Then I hope to write the expression into autolisp. I know common lisp
is a little to Autolisp but I thought this forum could help me.
My problem is the vertical lines; when I try to define one zone that
has a vertical line, then my mathmatical expression is not correct.
for example
if y < a + bx + cx²
(but if both x < 6000
and y < 1250)
then set case to "zone 1"
you can see it excludes all x values less than 6000
and all y values less than 1250.
but this is not true as in zone one there are some y and x values that
have are in this zone.
Does anyone know how it should be written?
Thanks Russ
here is my attempt in autolisp:
Notice I have changed the quadratic equations to polynominal as its
more accurate,
and lengthpan = x value
heightpan = y value
(defun c:Zonegraph2 (/ LengthPan heightpan curve1 curve2 curve3 case)
(setq lengthpan (getreal "\nLength of panel: "))
(setq heightpan (getreal "\nHeight of panel: "))
;1st polynominal curve
(setq curve1 (+(+(+ 9354.9336;a
(* -4.0977001 LengthPan));b
(* 0.00075131309(* LengthPan LengthPan)));c
(*(*(* LengthPan LengthPan)LengthPan)-4.9011319 1e-8));c
)
;2nd polynominal curve
(setq curve2 (+(+(+ 9511.0396;a
(* -2.1337471 LengthPan));b
(* 0.00020160079 (* LengthPan LengthPan)));c
(*(*(* LengthPan LengthPan)LengthPan)-6.8103454 1e-9));c
)
;3rd polynominal curve
(setq curve3 (+(+(+ 13389.83;a
(* -2.2055819 LengthPan));b
(* 0.0001590664(* LengthPan LengthPan)));c
(*(*(* LengthPan LengthPan)LengthPan)-4.2412377 1e-9));c
)
(cond
(
(and
(< heightpan curve1)
(= < LengthPan 6000);problem line
(= < heightpan 1250);problem line
);and
(progn
(setq Case "zone 1")
(alert "zone 1")
);progn
)
;-----------------
(
;;; (or
(and
(> heightpan curve1)
(> LengthPan 6000);problem line
(< 1250 heightpan);problem line
);and
(and
(< heightpan curve2)
(= < LengthPan 1306);problem line
(= < heightpan 11500);problem line
);and
(progn
(setq Case "zone 2")
(alert "zone 2")
);progn
)
;-----------------
(
(and
(< heightpan curve3)
(> heightpan curve2)
(> LengthPan 1306);problem line
(> heightpan 11500);problem line
);and
(progn
(setq Case "zone 3")
(alert "zone 3")
);progn
)
;----------------
(
(> heightpan curve3)
(progn
(setq Case "zone 4")
(alert "zone 4")
)
)
;-----------------
);cond
(princ)
);defun