Lisp.Coздание орнамента
| Правила | Регистрация | Пользователи | Сообщения за день |  Справка по форуму | Файлообменник |

Вернуться   Форум DWG.RU > Программное обеспечение > Программирование > LISP > Lisp.Coздание орнамента

Lisp.Coздание орнамента

Ответ
Поиск в этой теме
Непрочитано 29.10.2013, 15:03 #1
Lisp.Coздание орнамента
promoODESSA
 
Регистрация: 29.10.2013
Сообщений: 2

Необходимо написать lisp, который создаст геометрический орнамент в указанном прямоугольном и круглом контуре, используя несколько заранее приготовленных образцов (может быть блоков).Это дипломная работа.Помогите пожалуйста с кодом, хотя бы что то похожее.
Просмотров: 1432
 
Непрочитано 29.10.2013, 18:53
#2
Vov.Ka


 
Регистрация: 21.07.2008
Луцьк
Сообщений: 179


с автокадом распространяется tutorial
почти, то что тебе нужно
Vov.Ka вне форума  
 
Автор темы   Непрочитано 29.10.2013, 19:14
#3
promoODESSA


 
Регистрация: 29.10.2013
Сообщений: 2


promoODESSA вне форума  
 
Непрочитано 29.10.2013, 19:48
1 | #4
gomer

строю, ломаю
 
Регистрация: 03.04.2008
Украина
Сообщений: 5,515


Код:
[Выделить все]
 ;;-----------------=={ Julia Set Fractal }==------------------;;
;;                                                            ;;
;;  The function will create a representation of the Julia    ;;
;;  set by iteration of the function:                         ;;
;;                                                            ;;
;;  f(z) = z^2 + c                                            ;;
;;                                                            ;;
;;  Where 'z' & 'c' are complex numbers. The fractal colour   ;;
;;  is determined by the number of iterations taken for the   ;;
;;  norm of the complex number generated by the above         ;;
;;  function to reach a limit (less than a predetermined      ;;
;;  maximum iteration number).                                ;;
;;                                                            ;;
;;  'c' is the constant for each calculation, this            ;;
;;  distinguishes the Julia set from the Mandelbrot set       ;;
;;  (in which 'c' is set to the complex values of each point) ;;
;;  For this reason, there are infinitely many Julia fractals,;;
;;  but only one Mandelbrot fractal.                          ;;
;;------------------------------------------------------------;;
;;  Note:                                                     ;;
;;  --------                                                  ;;
;;  Fractal calculation is CPU intensive and may take a       ;;
;;  long time to generate the result. Reduce the iteration    ;;
;;  limit and image size & resolution to decrease calculation ;;
;;  time.                                                     ;;
;;------------------------------------------------------------;;
;;  Author: Lee McDonnell, 2010                               ;;
;;                                                            ;;
;;  Copyright © 2010 by Lee McDonnell, All Rights Reserved.   ;;
;;  Contact: Lee Mac @ TheSwamp.org, CADTutor.net             ;;
;;------------------------------------------------------------;;

(defun c:jfract ( / iLim xMin xMax yMin yMax xInc yInc )
  (vl-load-com)

  (mapcar 'setvar '("PDMODE" "PDSIZE") '(0 0))
  
  (setq iLim 255              ;; Iteration Limit

        xMin -1.0 xMax  1.0   ;; Image Size
        yMin -1.0 yMax  1.0

        xInc 0.005 yInc 0.005 ;; Image Resolution

        Re[c] 0.285           ;; Real Coefficient of Julia Constant

        Im[c] 0.01            ;; Imaginary Coefficient of Julia Constant

  )

  (
    (lambda ( x )
      (while (<= (setq x (+ x xInc)) xMax)
        (
          (lambda ( y / i a b n )
            (while (<= (setq y (+ y yInc)) yMax)

              (setq i 0 a x b y)

              (while (and (< (+ (* a a) (* b b)) 4.) (<= (setq i (1+ i)) iLim))

                (setq n (z^2 a b)
                      a (+ (car  n) Re[c])
                      b (+ (cadr n) Im[c])
                )
              )
              (entmakex (list (cons 0 "POINT") (list 10 x y) (cons 62 (1+ (rem (+ 30 i) 255)))))
            )
          )
          (- yMin yInc)
        )
      )
    )
    (- xMin xInc)
  )

  (princ)
)

;; Square of Complex Number
(defun z^2 ( x y ) (list (- (* x x) (* y y)) (* 2.0 x y)))
gomer вне форума  
 
Непрочитано 30.10.2013, 06:40
#5
AndruxaZ


 
Регистрация: 07.05.2013
Сообщений: 48


gomer, суперский код !!!
AndruxaZ вне форума  
 
Непрочитано 30.10.2013, 09:05
#6
Кулик Алексей aka kpblc
Moderator

LISP, C# (ACAD 200[9,12,13,14])
 
Регистрация: 25.08.2003
С.-Петербург
Сообщений: 40,404


Одно из двух - либо автор показывает, на чем споткнулся, либо теме место в "Поиске исполнителей".
__________________
Моя библиотека lisp-функций
---
Обращение ко мне - на "ты".
Все, что сказано - личное мнение.
Кулик Алексей aka kpblc вне форума  
Ответ
Вернуться   Форум DWG.RU > Программное обеспечение > Программирование > LISP > Lisp.Coздание орнамента