Author Topic: Solving the minimum value: B( English is not good, sorry!)  (Read 5251 times)

0 Members and 1 Guest are viewing this topic.

Q1241274614

  • Guest
Solving the minimum value: B( English is not good, sorry!)
« on: August 24, 2012, 09:19:43 PM »
Because English is not good, wrong place please forgive!

Known conditions: 1. A1, A2 two closed area, known as the A.

Solving the minimum value: B

« Last Edit: September 21, 2012, 08:33:50 PM by Q1241274614 »

Rod

  • Newt
  • Posts: 185
Re: Solving the minimum value: B
« Reply #1 on: August 25, 2012, 02:04:39 AM »
Need more information.
Are the sides always arcs and do they always curve in?
Do you know the distance between each point of A1 and A2?
Do they always have four sides?
Do you know A the height of the final rectangle?
Can A1 or A2 be mirrored?
« Last Edit: August 25, 2012, 02:09:04 AM by Rod »
"All models are wrong, some models are useful" - George Box

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Solving the minimum value: B
« Reply #2 on: August 25, 2012, 04:17:45 AM »
you are writing a program cutting?


chlh_jd

  • Guest
Re: Solving the minimum value: B
« Reply #3 on: August 27, 2012, 02:13:58 AM »
If just to solve B , First separately cal the fit angles of A1 & B1 , Second Devide the fit angle to cal min B , and then  recursive within 2 times unit angle for get more accurate result .
If the two units A1 & B1 no rotate , it's just move B to A for no collision .
http://www.theswamp.org/index.php?topic=39451.msg447159#msg447159
« Last Edit: August 27, 2012, 02:21:09 AM by chlh_jd »

chlh_jd

  • Guest
Re: Solving the minimum value: B
« Reply #4 on: August 28, 2012, 07:17:07 AM »
Ask give directions to
This would be like .
Not simply seek multiple line distance, also considering the rotation later distance, thank you!
不是简单求多段线距离,还要考虑旋转以后的距离,谢谢
For other type curves , it can be solve such as polygon , just need to change the accuracy  for getting points of the curve .
For rotates the curve , it can be found so much function in here if you searched .

chlh_jd

  • Guest
Re: Solving the minimum value: B
« Reply #5 on: September 17, 2012, 10:38:54 AM »
Some , Just mid Test , So here not post the whole codes .
Code: [Select]
(defun c:test(/ ss ssen en0 en1 et0 et1 tor pl0 pl1 p0 p1 v0 i0 aa ai0 il ai1 pl11 am0 am1)
  (setq ss (ssget '((0 . "LWPOLYLINE") (70 . 1))))
  (setq ssen (ss2lst ss nil))
  (setq en0 (car ssen)
en1 (cadr ssen))
  (if (and en0 en1)
    (progn
      (or (setq tor (getreal "\ntype in avoid distance <0.0> :"))
  (setq tor 0.0))
      (setq et0 (entget en0)
    et1 (entget en1))
      (setq pl0 (ss-assoc 10 et0)
    pl1 (ss-assoc 10 et1))
      (setq p0 (ss:polygon:centroid pl0)
    p1 (ss:polygon:centroid pl1))
      (setq v0 (pt- p0 p1))
      (setq pl1 (mapcar (function (lambda (x)
     (pt- x v0)))
pl1))
      (setq i0 0
    aa 1e99)
      (repeat 60
(setq ai0 (* _2pi (/ i0  60)))
(setq i1 0)      
(repeat 60
  (setq ai1 (* _2pi (/ i1  60)))
  (setq pl11 (mapcar (function (lambda (x)
(gsls-papr x p0 ai1)))
    pl1))
  (setq pl11 (ss:polygon:ang-avoid pl0 pl11 ai0 tor))
  (setq aai (cadr (ss:polygon:MinArea-OutSRectangle (append pl0 pl11))))
  (if (< aai aa)
    (setq aa aai
  am0 ai0
  am1 ai1
  res pl11))
  (setq i1 (1+ i1)))
(setq i0 (1+ i0)))
      (setq ai0 (- am0 (* 6.0 _1d))    
    i0 0)
      (repeat 12
(setq ai0 (+ ai0 (* i0 _1d))
      ai1 (- am1 (* 6.0 _1d)))
(setq i1 0)      
(repeat 12
  (setq ai1 (+ ai1 (* i1 _1d)))
  (setq pl11 (mapcar (function (lambda (x)
(gsls-papr x p0 ai1)))
    pl1))
  (setq pl11 (ss:polygon:ang-avoid pl0 pl11 ai0 tor))  
  (if (< (setq aai (cadr (ss:polygon:MinArea-OutSRectangle (append pl0 pl11)))) aa)
    (setq aa aai
  am0 ai0
  am1 ai1
  res pl11))
  (setq i1 (1+ i1)))
(setq i0 (1+ i0)))
      (draw-pl (list res (cons 62 1)))
      (draw-pl (list (car (ss:polygon:MinArea-OutSRectangle (append pl0 res))) (cons 62 2)))
      )
    )
  (princ (strcat "\n MinAreaOutRect angle = " (angtos am0) "Dgree ; Round angle = " (angtos am1) "Dgree ."))
  (princ)
  )

chlh_jd

  • Guest
Re: Solving the minimum value: B
« Reply #6 on: September 17, 2012, 11:06:15 AM »
I think this way may be simply for solve some case .

chlh_jd

  • Guest
Re: Solving the minimum value: B
« Reply #7 on: September 17, 2012, 12:08:41 PM »
From flat position figure to close position diagram, you can analog gravity whereabouts method within the limited sides.

chlh_jd

  • Guest
Re: Solving the minimum value: B
« Reply #8 on: September 17, 2012, 12:20:06 PM »
2 objects envelope good treatment, N objects!
If N! is too much.
This problem is NP-hard problem , I think to save computing time, you may have to get the approximate optimal solution, such as genetic algorithms, simulated annealing, ant colony optimization algorithm,artificial neural networks .
For Artificial Intelligence , I think Lisp will be well-qualified .
I guess Evgeniy Master has write a generic genetic algorithm by Vlisp , why don't you ask he the next  :-D
(setq v0 (pt- p0 p1))?
Create a vector P1->P0
« Last Edit: September 17, 2012, 12:28:43 PM by chlh_jd »

chlh_jd

  • Guest
Re: Solving the minimum value: B
« Reply #9 on: September 20, 2012, 08:49:13 AM »
You're welcome !
The gif you post , Seems not the Min side Result .
In my suggest method , must cal 8 times for Every side and side  to cal Min Area OutRectangle , Cal 2 times for Eeach Min Side to cal Min Side OutRectangle .
See the picture .
« Last Edit: September 20, 2012, 08:59:45 AM by chlh_jd »

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Solving the minimum value: B
« Reply #10 on: September 21, 2012, 04:51:02 PM »
If the calculation of N! Speed and effect are not same, genetic algorithm, please enlighten.

Discussed here Genetic Algorithm

Q1241274614

  • Guest
Re: Solving the minimum value: B
« Reply #11 on: September 21, 2012, 08:12:10 PM »
Thank you ElpanovEvgeniy,chlh_jd !
« Last Edit: September 21, 2012, 11:49:51 PM by Q1241274614 »

Q1241274614

  • Guest
Re: Solving the minimum value: B( English is not good, sorry!)
« Reply #12 on: November 28, 2013, 02:33:30 AM »
come on!