mirror of https://github.com/vitalif/openscad
Ported recent changes to master into the visitor branch
commit
d24b3cc84d
16
README
16
README
|
@ -34,13 +34,19 @@ To build OpenSCAD, you need some libraries and tools. The version
|
|||
numbers in brackets specify the versions which have been used for
|
||||
development. Other versions may or may not work as well..
|
||||
|
||||
* Qt4 (4.4 - 4.6):
|
||||
* Qt4 (4.4 - 4.7):
|
||||
http://www.qtsoftware.com/
|
||||
|
||||
* CGAL (3.5.x):
|
||||
* CGAL (3.6 - 3.7):
|
||||
http://www.cgal.org/
|
||||
|
||||
* boost (1.35 - 1.41, required by CGAL)
|
||||
* GMP (5.0.x):
|
||||
http://www.gmplib.org/
|
||||
|
||||
* MPFR (3.0.x):
|
||||
http://www.mpfr.org/
|
||||
|
||||
* boost (1.35 - 1.44, required by CGAL)
|
||||
http://www.boost.org/
|
||||
|
||||
* cmake (2.6.x, required by CGAL)
|
||||
|
@ -49,13 +55,13 @@ development. Other versions may or may not work as well..
|
|||
* OpenCSG (1.3.0):
|
||||
http://www.opencsg.org/
|
||||
|
||||
* GLEW (bundled with OpenCSG)
|
||||
* GLEW (1.5.x, also bundled with OpenCSG)
|
||||
http://glew.sourceforge.net/
|
||||
|
||||
* Eigen2 (2.0.11)
|
||||
http://eigen.tuxfamily.org/
|
||||
|
||||
* GCC C++ Compiler (4.0, 4.2, 4.3.1):
|
||||
* GCC C++ Compiler (4.2, 4.3.1):
|
||||
http://gcc.gnu.org/
|
||||
|
||||
* Bison (2.4):
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
|
||||
OpenSCAD 2010.XX
|
||||
OpenSCAD 2011.XX
|
||||
================
|
||||
|
||||
o Added rands() function
|
||||
o Added sign() function
|
||||
o Bugfixes: More robust DXF export
|
||||
o Added hull() for convex hulls (2D object only)
|
||||
o minkowski() now supports 2D objects
|
||||
o Added functions: rands(), sign()
|
||||
o Now supports escaping of the following characters in strings: \n, \t, \r, \\, \"
|
||||
o Support nested includes
|
||||
o Improved parsing of numbers
|
||||
o DXF: output LWPOLYLINE instead of just LINE entities
|
||||
o Bugfixes: More robust DXF export, setting $fs/$fa to 0 caused a crash
|
||||
o Some bugs fixed, maybe some new bugs added
|
||||
|
||||
OpenSCAD 2010.05
|
||||
================
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#setup bison for qmake
|
||||
bison.name = Bison ${QMAKE_FILE_IN}
|
||||
bison.input = BISONSOURCES
|
||||
bison.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.cpp
|
||||
bison.commands = bison -d -p ${QMAKE_FILE_BASE} -o ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.cpp ${QMAKE_FILE_IN}
|
||||
bison.commands += && mv ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.hpp ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.h
|
||||
bison.CONFIG += target_predeps
|
||||
bison.variable_out = GENERATED_SOURCES
|
||||
silent:bison.commands = @echo Bison ${QMAKE_FILE_IN} && $$bison.commands
|
||||
QMAKE_EXTRA_COMPILERS += bison
|
||||
bison_header.input = BISONSOURCES
|
||||
bison_header.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.h
|
||||
bison_header.commands = bison -d -p ${QMAKE_FILE_BASE} -o ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.cpp ${QMAKE_FILE_IN}
|
||||
bison_header.commands += && mv ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.hpp ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}_yacc.h
|
||||
bison_header.CONFIG += target_predeps no_link
|
||||
silent:bison_header.commands = @echo Bison ${QMAKE_FILE_IN} && $$bison.commands
|
||||
QMAKE_EXTRA_COMPILERS += bison_header
|
|
@ -0,0 +1,18 @@
|
|||
boost {
|
||||
isEmpty(DEPLOYDIR) {
|
||||
# Optionally specify location of boost using the
|
||||
# BOOSTDIR env. variable
|
||||
BOOST_DIR = $$(BOOSTDIR)
|
||||
!isEmpty(BOOST_DIR) {
|
||||
INCLUDEPATH += $$BOOST_DIR
|
||||
message("boost location: $$BOOST_DIR")
|
||||
win32:LIBS += -L$$BOOST_DIR/lib
|
||||
}
|
||||
}
|
||||
|
||||
win32 {
|
||||
LIBS += -llibboost_thread-vc90-mt-s-1_46_1 -llibboost_program_options-vc90-mt-s-1_46_1
|
||||
} else {
|
||||
LIBS += -lboost_thread -lboost_program_options
|
||||
}
|
||||
}
|
7
cgal.pri
7
cgal.pri
|
@ -7,11 +7,16 @@ cgal {
|
|||
CGAL_DIR = $$(CGALDIR)
|
||||
!isEmpty(CGAL_DIR) {
|
||||
INCLUDEPATH += $$CGAL_DIR/include
|
||||
win32: INCLUDEPATH += $$CGAL_DIR/auxiliary/gmp/include
|
||||
LIBS += -L$$CGAL_DIR/lib
|
||||
message("CGAL location: $$CGAL_DIR")
|
||||
}
|
||||
}
|
||||
|
||||
LIBS += -lCGAL -lmpfr -lgmp -lboost_thread
|
||||
win32 {
|
||||
LIBS += $$CGAL_DIR/auxiliary/gmp/lib/libmpfr-4.lib -lCGAL-vc90-mt-gd
|
||||
} else {
|
||||
LIBS += -lgmp -lmpfr -lCGAL
|
||||
}
|
||||
QMAKE_CXXFLAGS += -frounding-math
|
||||
}
|
||||
|
|
|
@ -71,12 +71,16 @@ o 3D View
|
|||
- Improve mouse rotation
|
||||
- Add modifier key combos to handle pan and zoom on 1 mouse button systems
|
||||
- Show grid
|
||||
- Measurement ticks on the axes that look like rulers that one can turn off and on.
|
||||
- 4 x split view w/orthogonal cameras?
|
||||
- Quick highlighting of object under the cursor in the editor
|
||||
- View All
|
||||
- Allow specifying viewpoint in the scad file
|
||||
- overlay indicator displaying current view mode
|
||||
- OpenCSG rendering: Coincident surfaces causes z-buffer fighting. Is this somehow
|
||||
avoidable tuning the depth tests in OpenCSG?
|
||||
- Use OpenGL picking to facilitate ray-tracing like features like measuring
|
||||
thicknesses, distances, slot thicknesses etc.
|
||||
o Editor wishlist
|
||||
- More infrastructure for external editor (allow communication from the outside)
|
||||
- Preferences GUI for the features below
|
||||
|
@ -134,11 +138,11 @@ o Language Frontend
|
|||
the "Flex & Bison" O'Reilly book, "Start States and Nested Input
|
||||
Files", page 28, for an example.
|
||||
- Allow local variables and functions everywhere (not only on module level)
|
||||
- allow 0/1 f/t FALSE/TRUE as boolean values
|
||||
- allow any expression to be evaluated as boolean (e.g. 1 = true, 0 = false)
|
||||
- allow any expression to be evaluated as boolean (!0 = true, 0 = false)
|
||||
- Rethink for vs. intersection_for vs. group. Should for loops
|
||||
generate child lists instead, and make these passable to other
|
||||
modules or accessible by child()?
|
||||
- constants: PI
|
||||
o DXF Import/Export
|
||||
- Use dxflib from RibbonSoft for import/export? -> investigate
|
||||
- Import
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
o Prerequisites (MacPorts):
|
||||
- NB! CGAL requires gcc >= 4.2 (This is default in 10.6 Snow Leopard)
|
||||
- eigen
|
||||
- boost
|
||||
- gmp
|
||||
- mpfr
|
||||
- cmake
|
||||
- qt4-mac-devel
|
||||
- glew
|
||||
|
||||
o An important note about paths:
|
||||
You can choose where to put the libs you build yourself as long as
|
||||
this is reflected in the environment variables as specified under
|
||||
'Build OpenSCAD'.
|
||||
|
||||
o Build CGAL >= 3.5
|
||||
|
||||
tar xzf CGAL-3.6.tar.gz
|
||||
cd CGAL-3.6
|
||||
cmake -DCMAKE_INSTALL_PREFIX=$PWD/../install/CGAL-3.6 -DBUILD_SHARED_LIBS=FALSE
|
||||
make -j4
|
||||
make install
|
||||
|
||||
o Patch OpenCSG >= 1.3.0
|
||||
|
||||
tar xzf OpenCSG-1.3.0.tar.gz
|
||||
cd OpenCSG-1.3.0
|
||||
patch -p1 < ../openscad/patches/OpenCSG-1.3.0-MacOSX-port.patch
|
||||
|
||||
o Build OpenCSG
|
||||
|
||||
qmake -recursive
|
||||
make
|
||||
|
||||
o Build OpenSCAD
|
||||
|
||||
cd openscad
|
||||
export OPENCSGDIR=$PWD/../OpenCSG-1.3.0
|
||||
export CGALDIR=$PWD/../install/CGAL-3.6
|
||||
qmake
|
||||
make
|
|
@ -0,0 +1,36 @@
|
|||
OpenSCAD Release Checklist
|
||||
--------------------------
|
||||
|
||||
o Update version
|
||||
release-linux.sh
|
||||
publish-macosx.sh
|
||||
FIXME: Windows
|
||||
|
||||
o Update RELEASE_NOTES
|
||||
|
||||
o Tag release
|
||||
git tag "openscad-2011.01"
|
||||
|
||||
o build source package
|
||||
git archive --format=tar openscad-2011.01 --prefix=openscad-2011.01/ | gzip > openscad-2011.01.tar.gz
|
||||
|
||||
o build binaries
|
||||
Mac OS X
|
||||
- publish-macosx.sh -> OpenSCAD-2011.01.dmg
|
||||
Linux: FIXME 32 vs. 64 bit
|
||||
- release-linux.sh
|
||||
Windows: FIXME 32 vs. 64 bit
|
||||
|
||||
o Set back version: release-linux.sh, publish-macosx.sh, FIXME: Windows
|
||||
|
||||
o Upload
|
||||
- Github
|
||||
Upload manually here: https://github.com/openscad/openscad/downloads
|
||||
FIXME: Write a script
|
||||
|
||||
- Google code
|
||||
- Get password from https://code.google.com/hosting/settings
|
||||
./scripts/googlecode_upload.py -u kintel -w <passwd> -s "OpenSCAD 2011.11 Windows" -p openscad openscad-2011.01.win32.zip
|
||||
./scripts/googlecode_upload.py -u kintel -w <passwd> -s "OpenSCAD 2011.11 Linux x86" -p openscad openscad-2011.01.linux-x86.tar.gz
|
||||
./scripts/googlecode_upload.py -u kintel -w <passwd> -s "OpenSCAD 2011.11 Mac OS X" -p openscad openscad-2011.01.dmg
|
||||
./scripts/googlecode_upload.py -u kintel -w <passwd> -s "OpenSCAD 2011.11 Source code" -p openscad openscad-2011.01.src.tar.gz
|
|
@ -0,0 +1,10 @@
|
|||
#setup flex for qmake
|
||||
|
||||
flex.name = Flex ${QMAKE_FILE_IN}
|
||||
flex.input = FLEXSOURCES
|
||||
flex.output = ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.lexer.cpp
|
||||
flex.commands = flex -P ${QMAKE_FILE_BASE} -o ${QMAKE_FILE_PATH}/${QMAKE_FILE_BASE}.lexer.cpp ${QMAKE_FILE_IN}
|
||||
flex.CONFIG += target_predeps
|
||||
flex.variable_out = GENERATED_SOURCES
|
||||
silent:flex.commands = @echo Lex ${QMAKE_FILE_IN} && $$flex.commands
|
||||
QMAKE_EXTRA_COMPILERS += flex
|
2
glew.pri
2
glew.pri
|
@ -15,5 +15,5 @@ glew {
|
|||
}
|
||||
|
||||
unix:LIBS += -lGLEW
|
||||
win32:LIBS += -lglew32
|
||||
win32:LIBS += -lglew32s
|
||||
}
|
||||
|
|
52
openscad.pro
52
openscad.pro
|
@ -1,5 +1,43 @@
|
|||
isEmpty(VERSION) VERSION = $$system(date "+%Y.%m.%d")
|
||||
# Auto-include config_<variant>.pri if the VARIANT variable is give on the
|
||||
# command-line, e.g. qmake VARIANT=mybuild
|
||||
!isEmpty(VARIANT) {
|
||||
message("Variant: $${VARIANT}")
|
||||
exists(config_$${VARIANT}.pri) {
|
||||
message("Including config_$${VARIANT}.pri")
|
||||
include(config_$${VARIANT}.pri)
|
||||
}
|
||||
}
|
||||
|
||||
win32 {
|
||||
isEmpty(VERSION) VERSION = $$system(date /t)
|
||||
} else {
|
||||
isEmpty(VERSION) VERSION = $$system(date "+%Y.%m.%d")
|
||||
}
|
||||
|
||||
#configure lex / yacc
|
||||
win32 {
|
||||
include(flex.pri)
|
||||
include(bison.pri)
|
||||
FLEXSOURCES = src/lexer.l
|
||||
BISONSOURCES = src/parser.y
|
||||
} else {
|
||||
LEXSOURCES += src/lexer.l
|
||||
YACCSOURCES += src/parser.y
|
||||
}
|
||||
|
||||
#configure additional directories
|
||||
win32 {
|
||||
INCLUDEPATH += $$(MPIRDIR)
|
||||
INCLUDEPATH += $$(MPFRDIR)
|
||||
}
|
||||
|
||||
DEFINES += OPENSCAD_VERSION=$$VERSION
|
||||
win32:DEFINES += _USE_MATH_DEFINES NOMINMAX _CRT_SECURE_NO_WARNINGS YY_NO_UNISTD_H
|
||||
|
||||
#disable warning about too long decorated names
|
||||
win32:QMAKE_CXXFLAGS += -wd4503
|
||||
|
||||
|
||||
TEMPLATE = app
|
||||
RESOURCES = openscad.qrc
|
||||
|
||||
|
@ -45,6 +83,7 @@ macx:CONFIG += mdi
|
|||
CONFIG += cgal
|
||||
CONFIG += opencsg
|
||||
CONFIG += progresswidget
|
||||
CONFIG += boost
|
||||
|
||||
#Uncomment the following line to enable QCodeEdit
|
||||
#CONFIG += qcodeedit
|
||||
|
@ -64,6 +103,7 @@ progresswidget {
|
|||
include(cgal.pri)
|
||||
include(opencsg.pri)
|
||||
include(eigen2.pri)
|
||||
include(boost.pri)
|
||||
|
||||
# Standard include path for misc external libs
|
||||
#macx {
|
||||
|
@ -74,8 +114,6 @@ include(eigen2.pri)
|
|||
# QMAKE_CXXFLAGS += -pg
|
||||
# QMAKE_LFLAGS += -pg
|
||||
|
||||
LEXSOURCES += src/lexer.l
|
||||
YACCSOURCES += src/parser.y
|
||||
|
||||
FORMS += src/MainWindow.ui \
|
||||
src/Preferences.ui
|
||||
|
@ -121,7 +159,8 @@ HEADERS += src/CGAL_renderer.h \
|
|||
src/PolySetCGALRenderer.h \
|
||||
src/CSGTermRenderer.h \
|
||||
src/myqhash.h \
|
||||
src/Tree.h
|
||||
src/Tree.h \
|
||||
src/mathc99.h
|
||||
|
||||
SOURCES += src/openscad.cc \
|
||||
src/mainwin.cc \
|
||||
|
@ -140,6 +179,7 @@ SOURCES += src/openscad.cc \
|
|||
src/primitives.cc \
|
||||
src/projection.cc \
|
||||
src/cgaladv.cc \
|
||||
src/cgaladv_convexhull2.cc \
|
||||
src/cgaladv_minkowski3.cc \
|
||||
src/cgaladv_minkowski2.cc \
|
||||
src/surface.cc \
|
||||
|
@ -166,7 +206,8 @@ SOURCES += src/openscad.cc \
|
|||
src/PolySetCGALRenderer.cc \
|
||||
src/CSGTermRenderer.cc \
|
||||
src/qhash.cc \
|
||||
src/Tree.cc
|
||||
src/Tree.cc \
|
||||
src/mathc99.cc
|
||||
|
||||
macx {
|
||||
HEADERS += src/AppleEvents.h \
|
||||
|
@ -184,4 +225,3 @@ INSTALLS += examples
|
|||
libraries.path = /usr/local/share/openscad/libraries/
|
||||
libraries.files = libraries/*
|
||||
INSTALLS += libraries
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ VS_VERSION_INFO VERSIONINFO
|
|||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "OpenSCAD Executable\0"
|
||||
VALUE "FileVersion", "development build\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2009 Clifford Wolf\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2009-2011 Clifford Wolf and Marius Kintel\0"
|
||||
VALUE "OriginalFilename", "openscad.exe\0"
|
||||
VALUE "ProductName", "OpenSCAD\0"
|
||||
END
|
||||
|
|
|
@ -476,7 +476,7 @@ elf_open(const char *filename, int flags, Elf_Ehdr *ehdr)
|
|||
if (ehdr->e_phentsize != sizeof(Elf_Phdr))
|
||||
{
|
||||
fprintf(stderr, "section size was read as %d, not %d!\n",
|
||||
ehdr->e_phentsize, sizeof(Elf_Phdr));
|
||||
ehdr->e_phentsize, (int)sizeof(Elf_Phdr));
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,248 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
|
||||
# Author: danderson@google.com (David Anderson)
|
||||
#
|
||||
# Script for uploading files to a Google Code project.
|
||||
#
|
||||
# This is intended to be both a useful script for people who want to
|
||||
# streamline project uploads and a reference implementation for
|
||||
# uploading files to Google Code projects.
|
||||
#
|
||||
# To upload a file to Google Code, you need to provide a path to the
|
||||
# file on your local machine, a small summary of what the file is, a
|
||||
# project name, and a valid account that is a member or owner of that
|
||||
# project. You can optionally provide a list of labels that apply to
|
||||
# the file. The file will be uploaded under the same name that it has
|
||||
# in your local filesystem (that is, the "basename" or last path
|
||||
# component). Run the script with '--help' to get the exact syntax
|
||||
# and available options.
|
||||
#
|
||||
# Note that the upload script requests that you enter your
|
||||
# googlecode.com password. This is NOT your Gmail account password!
|
||||
# This is the password you use on googlecode.com for committing to
|
||||
# Subversion and uploading files. You can find your password by going
|
||||
# to http://code.google.com/hosting/settings when logged in with your
|
||||
# Gmail account. If you have already committed to your project's
|
||||
# Subversion repository, the script will automatically retrieve your
|
||||
# credentials from there (unless disabled, see the output of '--help'
|
||||
# for details).
|
||||
#
|
||||
# If you are looking at this script as a reference for implementing
|
||||
# your own Google Code file uploader, then you should take a look at
|
||||
# the upload() function, which is the meat of the uploader. You
|
||||
# basically need to build a multipart/form-data POST request with the
|
||||
# right fields and send it to https://PROJECT.googlecode.com/files .
|
||||
# Authenticate the request using HTTP Basic authentication, as is
|
||||
# shown below.
|
||||
#
|
||||
# Licensed under the terms of the Apache Software License 2.0:
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Questions, comments, feature requests and patches are most welcome.
|
||||
# Please direct all of these to the Google Code users group:
|
||||
# http://groups.google.com/group/google-code-hosting
|
||||
|
||||
"""Google Code file uploader script.
|
||||
"""
|
||||
|
||||
__author__ = 'danderson@google.com (David Anderson)'
|
||||
|
||||
import httplib
|
||||
import os.path
|
||||
import optparse
|
||||
import getpass
|
||||
import base64
|
||||
import sys
|
||||
|
||||
|
||||
def upload(file, project_name, user_name, password, summary, labels=None):
|
||||
"""Upload a file to a Google Code project's file server.
|
||||
|
||||
Args:
|
||||
file: The local path to the file.
|
||||
project_name: The name of your project on Google Code.
|
||||
user_name: Your Google account name.
|
||||
password: The googlecode.com password for your account.
|
||||
Note that this is NOT your global Google Account password!
|
||||
summary: A small description for the file.
|
||||
labels: an optional list of label strings with which to tag the file.
|
||||
|
||||
Returns: a tuple:
|
||||
http_status: 201 if the upload succeeded, something else if an
|
||||
error occured.
|
||||
http_reason: The human-readable string associated with http_status
|
||||
file_url: If the upload succeeded, the URL of the file on Google
|
||||
Code, None otherwise.
|
||||
"""
|
||||
# The login is the user part of user@gmail.com. If the login provided
|
||||
# is in the full user@domain form, strip it down.
|
||||
if user_name.endswith('@gmail.com'):
|
||||
user_name = user_name[:user_name.index('@gmail.com')]
|
||||
|
||||
form_fields = [('summary', summary)]
|
||||
if labels is not None:
|
||||
form_fields.extend([('label', l.strip()) for l in labels])
|
||||
|
||||
content_type, body = encode_upload_request(form_fields, file)
|
||||
|
||||
upload_host = '%s.googlecode.com' % project_name
|
||||
upload_uri = '/files'
|
||||
auth_token = base64.b64encode('%s:%s'% (user_name, password))
|
||||
headers = {
|
||||
'Authorization': 'Basic %s' % auth_token,
|
||||
'User-Agent': 'Googlecode.com uploader v0.9.4',
|
||||
'Content-Type': content_type,
|
||||
}
|
||||
|
||||
server = httplib.HTTPSConnection(upload_host)
|
||||
server.request('POST', upload_uri, body, headers)
|
||||
resp = server.getresponse()
|
||||
server.close()
|
||||
|
||||
if resp.status == 201:
|
||||
location = resp.getheader('Location', None)
|
||||
else:
|
||||
location = None
|
||||
return resp.status, resp.reason, location
|
||||
|
||||
|
||||
def encode_upload_request(fields, file_path):
|
||||
"""Encode the given fields and file into a multipart form body.
|
||||
|
||||
fields is a sequence of (name, value) pairs. file is the path of
|
||||
the file to upload. The file will be uploaded to Google Code with
|
||||
the same file name.
|
||||
|
||||
Returns: (content_type, body) ready for httplib.HTTP instance
|
||||
"""
|
||||
BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla'
|
||||
CRLF = '\r\n'
|
||||
|
||||
body = []
|
||||
|
||||
# Add the metadata about the upload first
|
||||
for key, value in fields:
|
||||
body.extend(
|
||||
['--' + BOUNDARY,
|
||||
'Content-Disposition: form-data; name="%s"' % key,
|
||||
'',
|
||||
value,
|
||||
])
|
||||
|
||||
# Now add the file itself
|
||||
file_name = os.path.basename(file_path)
|
||||
f = open(file_path, 'rb')
|
||||
file_content = f.read()
|
||||
f.close()
|
||||
|
||||
body.extend(
|
||||
['--' + BOUNDARY,
|
||||
'Content-Disposition: form-data; name="filename"; filename="%s"'
|
||||
% file_name,
|
||||
# The upload server determines the mime-type, no need to set it.
|
||||
'Content-Type: application/octet-stream',
|
||||
'',
|
||||
file_content,
|
||||
])
|
||||
|
||||
# Finalize the form body
|
||||
body.extend(['--' + BOUNDARY + '--', ''])
|
||||
|
||||
return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body)
|
||||
|
||||
|
||||
def upload_find_auth(file_path, project_name, summary, labels=None,
|
||||
user_name=None, password=None, tries=3):
|
||||
"""Find credentials and upload a file to a Google Code project's file server.
|
||||
|
||||
file_path, project_name, summary, and labels are passed as-is to upload.
|
||||
|
||||
Args:
|
||||
file_path: The local path to the file.
|
||||
project_name: The name of your project on Google Code.
|
||||
summary: A small description for the file.
|
||||
labels: an optional list of label strings with which to tag the file.
|
||||
config_dir: Path to Subversion configuration directory, 'none', or None.
|
||||
user_name: Your Google account name.
|
||||
tries: How many attempts to make.
|
||||
"""
|
||||
|
||||
while tries > 0:
|
||||
if user_name is None:
|
||||
# Read username if not specified or loaded from svn config, or on
|
||||
# subsequent tries.
|
||||
sys.stdout.write('Please enter your googlecode.com username: ')
|
||||
sys.stdout.flush()
|
||||
user_name = sys.stdin.readline().rstrip()
|
||||
if password is None:
|
||||
# Read password if not loaded from svn config, or on subsequent tries.
|
||||
print 'Please enter your googlecode.com password.'
|
||||
print '** Note that this is NOT your Gmail account password! **'
|
||||
print 'It is the password you use to access Subversion repositories,'
|
||||
print 'and can be found here: http://code.google.com/hosting/settings'
|
||||
password = getpass.getpass()
|
||||
|
||||
status, reason, url = upload(file_path, project_name, user_name, password,
|
||||
summary, labels)
|
||||
# Returns 403 Forbidden instead of 401 Unauthorized for bad
|
||||
# credentials as of 2007-07-17.
|
||||
if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]:
|
||||
# Rest for another try.
|
||||
user_name = password = None
|
||||
tries = tries - 1
|
||||
else:
|
||||
# We're done.
|
||||
break
|
||||
|
||||
return status, reason, url
|
||||
|
||||
|
||||
def main():
|
||||
parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '
|
||||
'-p PROJECT [options] FILE')
|
||||
parser.add_option('-s', '--summary', dest='summary',
|
||||
help='Short description of the file')
|
||||
parser.add_option('-p', '--project', dest='project',
|
||||
help='Google Code project name')
|
||||
parser.add_option('-u', '--user', dest='user',
|
||||
help='Your Google Code username')
|
||||
parser.add_option('-w', '--password', dest='password',
|
||||
help='Your Google Code password')
|
||||
parser.add_option('-l', '--labels', dest='labels',
|
||||
help='An optional list of comma-separated labels to attach '
|
||||
'to the file')
|
||||
|
||||
options, args = parser.parse_args()
|
||||
|
||||
if not options.summary:
|
||||
parser.error('File summary is missing.')
|
||||
elif not options.project:
|
||||
parser.error('Project name is missing.')
|
||||
elif len(args) < 1:
|
||||
parser.error('File to upload not provided.')
|
||||
elif len(args) > 1:
|
||||
parser.error('Only one file may be specified.')
|
||||
|
||||
file_path = args[0]
|
||||
|
||||
if options.labels:
|
||||
labels = options.labels.split(',')
|
||||
else:
|
||||
labels = None
|
||||
|
||||
status, reason, url = upload_find_auth(file_path, options.project,
|
||||
options.summary, labels,
|
||||
options.user, options.password)
|
||||
if url:
|
||||
print 'The file was uploaded successfully.'
|
||||
print 'URL: %s' % url
|
||||
return 0
|
||||
else:
|
||||
print 'An error occurred. Your file was not uploaded.'
|
||||
print 'Google Code upload server said: %s (%s)' % (reason, status)
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -100,17 +100,18 @@ build_boost()
|
|||
{
|
||||
version=$1
|
||||
bversion=`echo $version | tr "." "_"`
|
||||
echo "Building boost::thread" $version "..."
|
||||
echo "Building boost" $version "..."
|
||||
cd $BASEDIR/src
|
||||
rm -rf boost*
|
||||
curl -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2
|
||||
tar xjf boost_$bversion.tar.bz2
|
||||
cd boost_$bversion
|
||||
# We only need the thread library for now
|
||||
./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread
|
||||
# We only need the thread and program_options libraries
|
||||
./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options
|
||||
./bjam cflags="-mmacosx-version-min=10.5 -arch i386 -arch x86_64" linkflags="-mmacosx-version-min=10.5 -arch i386 -arch x86_64"
|
||||
./bjam install
|
||||
install_name_tool -id $DEPLOYDIR/lib/libboost_thread.dylib $DEPLOYDIR/lib/libboost_thread.dylib
|
||||
install_name_tool -id $DEPLOYDIR/lib/libboost_program_options.dylib $DEPLOYDIR/lib/libboost_program_options.dylib
|
||||
}
|
||||
|
||||
build_cgal()
|
||||
|
@ -159,7 +160,7 @@ echo "Using basedir:" $BASEDIR
|
|||
mkdir -p $SRCDIR $DEPLOYDIR
|
||||
build_gmp 5.0.1
|
||||
build_mpfr 3.0.0
|
||||
build_boost 1.44.0
|
||||
build_boost 1.46.1
|
||||
build_cgal 3.7
|
||||
build_glew 1.5.6
|
||||
build_glew 1.5.8
|
||||
build_opencsg 1.3.0
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
#
|
||||
# Author: Marius Kintel <marius@kintel.net>
|
||||
#
|
||||
# This script lives here:
|
||||
# https://github.com/kintel/MacOSX-tools
|
||||
#
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
@ -49,9 +52,14 @@ def lookup_library(file):
|
|||
def find_dependencies(file):
|
||||
libs = []
|
||||
|
||||
p = subprocess.Popen(["otool", "-L", file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
output = p.communicate()[0]
|
||||
if p.returncode != 0: return None
|
||||
args = ["otool", "-L", file]
|
||||
if DEBUG: print "Executing " + " ".join(args)
|
||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
output,err = p.communicate()
|
||||
if p.returncode != 0:
|
||||
print "Failed with return code " + str(p.returncode) + ":"
|
||||
print err
|
||||
return None
|
||||
deps = output.split('\n')
|
||||
for dep in deps:
|
||||
# print dep
|
||||
|
|
|
@ -16,7 +16,7 @@ echo "Sanity check of the app bundle..."
|
|||
if [[ $? != 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
cp OpenSCAD-$VERSION.dmg ~/Documents/Dropbox/Public
|
||||
ln -sf OpenSCAD-$VERSION.dmg ~/Documents/Dropbox/Public/OpenSCAD-latest.dmg
|
||||
cp OpenSCAD-$VERSION.dmg ~/Dropbox/Public
|
||||
ln -sf OpenSCAD-$VERSION.dmg ~/Dropbox/Public/OpenSCAD-latest.dmg
|
||||
|
||||
echo "Upload in progress..."
|
||||
|
|
|
@ -60,6 +60,11 @@ void CGALRenderer::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedro
|
|||
case MINKOWSKI:
|
||||
target.p2 = minkowski2(target.p2, src.p2);
|
||||
break;
|
||||
case HULL:
|
||||
//FIXME: Port convex hull to a binary operator or process it all in the end somehow
|
||||
// target.p2 = convexhull2(target.p2, src.p2);
|
||||
// target.p2 = convexhull2(polys);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (target.dim == 3) {
|
||||
|
@ -76,6 +81,9 @@ void CGALRenderer::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedro
|
|||
case MINKOWSKI:
|
||||
target.p3 = minkowski3(target.p3, src.p3);
|
||||
break;
|
||||
case HULL:
|
||||
// FIXME: Print warning: hull() not supported in 3D
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ using std::pair;
|
|||
class CGALRenderer : public Visitor
|
||||
{
|
||||
public:
|
||||
enum CsgOp {UNION, INTERSECTION, DIFFERENCE, MINKOWSKI};
|
||||
enum CsgOp {UNION, INTERSECTION, DIFFERENCE, MINKOWSKI, HULL};
|
||||
// FIXME: If a cache is not given, we need to fix this ourselves
|
||||
CGALRenderer(QHash<string, CGAL_Nef_polyhedron> &cache, const Tree &tree) : cache(cache), tree(tree), psrenderer(*this) {}
|
||||
virtual ~CGALRenderer() {}
|
||||
|
|
|
@ -201,6 +201,9 @@ CSGTerm *CgaladvNode::render_csg_term(double m[20], QVector<CSGTerm*> *highlight
|
|||
if (type == SUBDIV)
|
||||
return render_csg_term_from_nef(m, highlights, background, "subdiv", this->convexity);
|
||||
|
||||
if (type == HULL)
|
||||
return render_csg_term_from_nef(m, highlights, background, "hull", this->convexity);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -208,7 +211,7 @@ CSGTerm *CgaladvNode::render_csg_term(double m[20], QVector<CSGTerm*> *highlight
|
|||
|
||||
CSGTerm *CgaladvNode::render_csg_term(double m[20], QVector<CSGTerm*> *highlights, QVector<CSGTerm*> *background) const
|
||||
{
|
||||
PRINT("WARNING: Found minkowski(), glide() or subdiv() statement but compiled without CGAL support!");
|
||||
PRINT("WARNING: Found minkowski(), glide(), subdiv() or hull() statement but compiled without CGAL support!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -360,7 +360,13 @@ PolySet *PolySetCGALRenderer::renderPolySet(const DxfRotateExtrudeNode &node,
|
|||
|
||||
int fragments = get_fragments_from_r(max_x, node.fn, node.fs, node.fa);
|
||||
|
||||
double points[fragments][dxf->paths[i].points.count()][3];
|
||||
double ***points;
|
||||
points = new double**[fragments];
|
||||
for (int j=0; j < fragments; j++) {
|
||||
points[j] = new double*[dxf->paths[i].points.count()];
|
||||
for (int k=0; k < dxf->paths[i].points.count(); k++)
|
||||
points[j][k] = new double[3];
|
||||
}
|
||||
|
||||
for (int j = 0; j < fragments; j++) {
|
||||
double a = (j*2*M_PI) / fragments;
|
||||
|
@ -404,6 +410,13 @@ PolySet *PolySetCGALRenderer::renderPolySet(const DxfRotateExtrudeNode &node,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int j=0; j < fragments; j++) {
|
||||
for (int k=0; k < dxf->paths[i].points.count(); k++)
|
||||
delete[] points[j][k];
|
||||
delete[] points[j];
|
||||
}
|
||||
delete[] points;
|
||||
}
|
||||
|
||||
delete dxf;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Nef_polyhedron_3.h>
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Polygon_2.h>
|
||||
#include <CGAL/Polygon_with_holes_2.h>
|
||||
|
||||
typedef CGAL::Extended_cartesian<CGAL::Gmpq> CGAL_Kernel2;
|
||||
typedef CGAL::Nef_polyhedron_2<CGAL_Kernel2> CGAL_Nef_polyhedron2;
|
||||
|
@ -24,6 +27,9 @@ typedef CGAL_Nef_polyhedron3::Aff_transformation_3 CGAL_Aff_transformation;
|
|||
typedef CGAL_Nef_polyhedron3::Vector_3 CGAL_Vector;
|
||||
typedef CGAL_Nef_polyhedron3::Plane_3 CGAL_Plane;
|
||||
typedef CGAL_Nef_polyhedron3::Point_3 CGAL_Point;
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel CGAL_ExactKernel2;
|
||||
typedef CGAL::Polygon_2<CGAL_ExactKernel2> CGAL_Poly2;
|
||||
typedef CGAL::Polygon_with_holes_2<CGAL_ExactKernel2> CGAL_Poly2h;
|
||||
|
||||
struct CGAL_Nef_polyhedron
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -36,12 +37,14 @@
|
|||
#ifdef ENABLE_CGAL
|
||||
extern CGAL_Nef_polyhedron3 minkowski3(CGAL_Nef_polyhedron3 a, CGAL_Nef_polyhedron3 b);
|
||||
extern CGAL_Nef_polyhedron2 minkowski2(CGAL_Nef_polyhedron2 a, CGAL_Nef_polyhedron2 b);
|
||||
extern CGAL_Nef_polyhedron2 convexhull2(std::list<CGAL_Nef_polyhedron2> a);
|
||||
#endif
|
||||
|
||||
enum cgaladv_type_e {
|
||||
MINKOWSKI,
|
||||
GLIDE,
|
||||
SUBDIV
|
||||
SUBDIV,
|
||||
HULL
|
||||
};
|
||||
|
||||
class CgaladvModule : public AbstractModule
|
||||
|
@ -143,6 +146,7 @@ void register_builtin_cgaladv()
|
|||
builtin_modules["minkowski"] = new CgaladvModule(MINKOWSKI);
|
||||
builtin_modules["glide"] = new CgaladvModule(GLIDE);
|
||||
builtin_modules["subdiv"] = new CgaladvModule(SUBDIV);
|
||||
builtin_modules["hull"] = new CgaladvModule(HULL);
|
||||
}
|
||||
|
||||
std::string CgaladvNode::toString() const
|
||||
|
@ -160,6 +164,9 @@ std::string CgaladvNode::toString() const
|
|||
case SUBDIV:
|
||||
stream << "(level = " << this->level << ", convexity = " << this->convexity << ")";
|
||||
break;
|
||||
case HULL:
|
||||
stream << "()";
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* As a special exception, you have permission to link this program
|
||||
* with the CGAL library and distribute executables, as long as you
|
||||
* follow the requirements of the GNU GPL in regard to all of the
|
||||
* software in the executable aside from CGAL.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ENABLE_CGAL
|
||||
|
||||
#include "cgal.h"
|
||||
#include <CGAL/convex_hull_2.h>
|
||||
|
||||
extern CGAL_Nef_polyhedron2 convexhull2(std::list<CGAL_Nef_polyhedron2> a);
|
||||
extern CGAL_Poly2 nef2p2(CGAL_Nef_polyhedron2 p);
|
||||
|
||||
CGAL_Nef_polyhedron2 convexhull2(std::list<CGAL_Nef_polyhedron2> a)
|
||||
{
|
||||
std::list<CGAL_Nef_polyhedron2::Point> points;
|
||||
|
||||
std::list<CGAL_Nef_polyhedron2>::iterator i;
|
||||
for (i=a.begin(); i!=a.end(); i++) {
|
||||
CGAL_Poly2 ap=nef2p2(*i);
|
||||
for (size_t j=0;j<ap.size();j++) {
|
||||
double x=to_double(ap[j].x()),y=to_double(ap[j].y());
|
||||
CGAL_Nef_polyhedron2::Point p=CGAL_Nef_polyhedron2::Point(x,y);
|
||||
points.push_back(p);
|
||||
}
|
||||
}
|
||||
|
||||
std::list<CGAL_Nef_polyhedron2::Point> result;
|
||||
CGAL::convex_hull_2(points.begin(),points.end(),std::back_inserter(result));
|
||||
|
||||
return CGAL_Nef_polyhedron2(result.begin(),result.end(),CGAL_Nef_polyhedron2::INCLUDED);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,20 +31,53 @@
|
|||
#include "grid.h"
|
||||
#include "cgal.h"
|
||||
|
||||
#if 0
|
||||
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/minkowski_sum_2.h>
|
||||
|
||||
extern CGAL_Nef_polyhedron2 minkowski2(CGAL_Nef_polyhedron2 a, CGAL_Nef_polyhedron2 b);
|
||||
extern CGAL_Poly2 nef2p2(CGAL_Nef_polyhedron2 p);
|
||||
|
||||
struct K2 : public CGAL::Exact_predicates_exact_constructions_kernel {};
|
||||
typedef CGAL::Polygon_2<K2> Poly2;
|
||||
typedef CGAL::Polygon_with_holes_2<K2> Poly2h;
|
||||
|
||||
static Poly2 nef2p2(CGAL_Nef_polyhedron2 p)
|
||||
//-----------------------------------------------------------------------------
|
||||
// Pretty-print a CGAL polygon.
|
||||
//
|
||||
template<class Kernel, class Container>
|
||||
void print_polygon (const CGAL::Polygon_2<Kernel, Container>& P)
|
||||
{
|
||||
std::list<K2::Point_2> points;
|
||||
typename CGAL::Polygon_2<Kernel, Container>::Vertex_const_iterator vit;
|
||||
|
||||
std::cout << "[ " << P.size() << " vertices:";
|
||||
for (vit = P.vertices_begin(); vit != P.vertices_end(); ++vit)
|
||||
std::cout << " (" << *vit << ')';
|
||||
std::cout << " ]" << std::endl;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Pretty-print a polygon with holes.
|
||||
//
|
||||
template<class Kernel, class Container>
|
||||
void print_polygon_with_holes (const CGAL::Polygon_with_holes_2<Kernel, Container>& pwh) {
|
||||
if (! pwh.is_unbounded()) {
|
||||
std::cout << "{ Outer boundary = ";
|
||||
print_polygon (pwh.outer_boundary());
|
||||
} else
|
||||
std::cout << "{ Unbounded polygon." << std::endl;
|
||||
|
||||
typename CGAL::Polygon_with_holes_2<Kernel,Container>::Hole_const_iterator hit;
|
||||
unsigned int k = 1;
|
||||
|
||||
std::cout << " " << pwh.number_of_holes() << " holes:" << std::endl;
|
||||
for (hit = pwh.holes_begin(); hit != pwh.holes_end(); ++hit, ++k) {
|
||||
std::cout << " Hole #" << k << " = ";
|
||||
print_polygon (*hit);
|
||||
}
|
||||
std::cout << " }" << std::endl;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CGAL_Poly2 nef2p2(CGAL_Nef_polyhedron2 p)
|
||||
{
|
||||
std::list<CGAL_ExactKernel2::Point_2> points;
|
||||
Grid2d<int> grid(GRID_COARSE);
|
||||
|
||||
typedef CGAL_Nef_polyhedron2::Explorer Explorer;
|
||||
|
@ -53,7 +87,11 @@ static Poly2 nef2p2(CGAL_Nef_polyhedron2 p)
|
|||
|
||||
for (fci_t fit = E.faces_begin(), fend = E.faces_end(); fit != fend; ++fit)
|
||||
{
|
||||
if (fit != E.faces_begin()) {
|
||||
if (!E.mark(fit)) {
|
||||
continue;
|
||||
}
|
||||
//if (fit != E.faces_begin()) {
|
||||
if (points.size() != 0) {
|
||||
PRINT("WARNING: minkowski() is not implemented for 2d objects with holes!");
|
||||
break;
|
||||
}
|
||||
|
@ -64,33 +102,41 @@ static Poly2 nef2p2(CGAL_Nef_polyhedron2 p)
|
|||
Explorer::Point ep = E.point(E.target(fcirc));
|
||||
double x = to_double(ep.x()), y = to_double(ep.y());
|
||||
grid.align(x, y);
|
||||
points.push_back(K2::Point_2(x, y));
|
||||
points.push_back(CGAL_ExactKernel2::Point_2(x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Poly2(points.begin(), points.end());
|
||||
return CGAL_Poly2(points.begin(), points.end());
|
||||
}
|
||||
static CGAL_Nef_polyhedron2 p2nef2(CGAL_Poly2 p2) {
|
||||
std::list<CGAL_Nef_polyhedron2::Point> points;
|
||||
for (size_t j = 0; j < p2.size(); j++) {
|
||||
double x = to_double(p2[j].x());
|
||||
double y = to_double(p2[j].y());
|
||||
CGAL_Nef_polyhedron2::Point p = CGAL_Nef_polyhedron2::Point(x, y);
|
||||
points.push_back(p);
|
||||
}
|
||||
return CGAL_Nef_polyhedron2(points.begin(), points.end(), CGAL_Nef_polyhedron2::INCLUDED);
|
||||
}
|
||||
|
||||
CGAL_Nef_polyhedron2 minkowski2(CGAL_Nef_polyhedron2 a, CGAL_Nef_polyhedron2 b)
|
||||
{
|
||||
Poly2 ap = nef2p2(a), bp = nef2p2(b);
|
||||
Poly2h x = minkowski_sum_2(ap, bp);
|
||||
/** FIXME **/
|
||||
|
||||
PRINT("WARNING: minkowski() is not implemented yet for 2d objects!");
|
||||
return CGAL_Nef_polyhedron2();
|
||||
}
|
||||
CGAL_Poly2 ap = nef2p2(a), bp = nef2p2(b);
|
||||
|
||||
#else
|
||||
if (ap.size() == 0) {
|
||||
PRINT("WARNING: minkowski() could not get any points from object 1!");
|
||||
return CGAL_Nef_polyhedron2();
|
||||
} else if (bp.size() == 0) {
|
||||
PRINT("WARNING: minkowski() could not get any points from object 2!");
|
||||
return CGAL_Nef_polyhedron2();
|
||||
} else {
|
||||
CGAL_Poly2h x = minkowski_sum_2(ap, bp);
|
||||
|
||||
CGAL_Nef_polyhedron2 minkowski2(CGAL_Nef_polyhedron2, CGAL_Nef_polyhedron2)
|
||||
{
|
||||
PRINT("WARNING: minkowski() is not implemented yet for 2d objects!");
|
||||
return CGAL_Nef_polyhedron2();
|
||||
// Make a CGAL_Nef_polyhedron2 out of just the boundary for starters
|
||||
return p2nef2(x.outer_boundary());
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,7 +33,7 @@
|
|||
#include <QTextStream>
|
||||
#include <QHash>
|
||||
#include <QVector>
|
||||
#include <math.h>
|
||||
#include "mathc99.h"
|
||||
#include <assert.h>
|
||||
|
||||
struct Line {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -31,11 +32,10 @@
|
|||
#include "printutils.h"
|
||||
#include "context.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include "mathc99.h"
|
||||
#include <QHash>
|
||||
#include <QDateTime>
|
||||
#include <QFileInfo>
|
||||
|
||||
QHash<QString,Value> dxf_dim_cache;
|
||||
QHash<QString,Value> dxf_cross_cache;
|
||||
|
@ -62,12 +62,10 @@ Value builtin_dxf_dim(const Context *ctx, const QVector<QString> &argnames, cons
|
|||
name = QString::fromStdString(args[i].text);
|
||||
}
|
||||
|
||||
struct stat st;
|
||||
memset(&st, 0, sizeof(struct stat));
|
||||
stat(filename.toAscii().data(), &st);
|
||||
QFileInfo fileInfo(filename);
|
||||
|
||||
QString key = filename + "|" + layername + "|" + name + "|" + QString::number(xorigin) + "|" + QString::number(yorigin) +
|
||||
"|" + QString::number(scale) + "|" + QString::number(st.st_mtime) + "|" + QString::number(st.st_size);
|
||||
"|" + QString::number(scale) + "|" + QString::number(fileInfo.lastModified().toTime_t()) + "|" + QString::number(fileInfo.size());
|
||||
|
||||
if (dxf_dim_cache.contains(key))
|
||||
return dxf_dim_cache[key];
|
||||
|
@ -144,12 +142,10 @@ Value builtin_dxf_cross(const Context *ctx, const QVector<QString> &argnames, co
|
|||
args[i].getnum(scale);
|
||||
}
|
||||
|
||||
struct stat st;
|
||||
memset(&st, 0, sizeof(struct stat));
|
||||
stat(filename.toAscii().data(), &st);
|
||||
QFileInfo fileInfo(filename);
|
||||
|
||||
QString key = filename + "|" + layername + "|" + QString::number(xorigin) + "|" + QString::number(yorigin) +
|
||||
"|" + QString::number(scale) + "|" + QString::number(st.st_mtime) + "|" + QString::number(st.st_size);
|
||||
"|" + QString::number(scale) + "|" + QString::number(fileInfo.lastModified().toTime_t()) + "|" + QString::number(fileInfo.size());
|
||||
|
||||
if (dxf_cross_cache.contains(key))
|
||||
return dxf_cross_cache[key];
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -37,14 +38,13 @@
|
|||
#include "PolySetRenderer.h"
|
||||
#include "openscad.h" // get_fragments_from_r()
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <sstream>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTime>
|
||||
#include <QProgressDialog>
|
||||
#include <QDateTime>
|
||||
#include <QFileInfo>
|
||||
|
||||
class DxfLinearExtrudeModule : public AbstractModule
|
||||
{
|
||||
|
@ -150,13 +150,11 @@ std::string DxfLinearExtrudeNode::toString() const
|
|||
std::stringstream stream;
|
||||
|
||||
QString text;
|
||||
struct stat st;
|
||||
memset(&st, 0, sizeof(struct stat));
|
||||
stat(this->filename.toAscii().data(), &st);
|
||||
QFileInfo fileInfo(this->filename);
|
||||
|
||||
stream << this->name() << "("
|
||||
"file = \"" << this->filename << "\", "
|
||||
"cache = \"" << std::hex << (int)st.st_mtime << "." << (int)st.st_size << "\", "
|
||||
"cache = \"" << std::hex << (int)fileInfo.lastModified().toTime_t() << "." << (int)fileInfo.size() << "\", "
|
||||
"layer = \"" << this->layername << "\", "
|
||||
"height = " << std::dec << this->height << ", "
|
||||
"origin = [ " << this->origin_x << " " << this->origin_y << " ], "
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -35,14 +36,13 @@
|
|||
#include "PolySetRenderer.h"
|
||||
#include "openscad.h" // get_fragments_from_r()
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <sstream>
|
||||
|
||||
#include <QTime>
|
||||
#include <QApplication>
|
||||
#include <QProgressDialog>
|
||||
#include <QDateTime>
|
||||
#include <QFileInfo>
|
||||
|
||||
class DxfRotateExtrudeModule : public AbstractModule
|
||||
{
|
||||
|
@ -125,12 +125,10 @@ std::string DxfRotateExtrudeNode::toString() const
|
|||
{
|
||||
std::stringstream stream;
|
||||
|
||||
struct stat st;
|
||||
memset(&st, 0, sizeof(struct stat));
|
||||
stat(filename.toAscii().data(), &st);
|
||||
QFileInfo fileInfo(this->filename);
|
||||
stream << this->name() << "("
|
||||
"file = \"" << this->filename << "\", "
|
||||
"cache = \"" << std::hex << (int)st.st_mtime << "." << (int)st.st_size << "\", "
|
||||
"cache = \"" << std::hex << (int)fileInfo.lastModified().toTime_t() << "." << (int)fileInfo.size() << "\", "
|
||||
"layer = \"" << this->layername << "\", "
|
||||
"origin = [ " << std::dec << this->origin_x << " " << this->origin_y << " ], "
|
||||
"scale = " << this->scale << ", "
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# include <GL/glew.h>
|
||||
#endif
|
||||
#include <qgl.h>
|
||||
#include <math.h>
|
||||
#include "mathc99.h"
|
||||
|
||||
#ifdef WIN32
|
||||
# define STDCALL __stdcall
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -28,8 +29,8 @@
|
|||
#include "context.h"
|
||||
#include "dxfdim.h"
|
||||
#include "builtin.h"
|
||||
#include <math.h>
|
||||
#include <sstream>
|
||||
#include "mathc99.h"
|
||||
|
||||
AbstractFunction::~AbstractFunction()
|
||||
{
|
||||
|
@ -290,7 +291,7 @@ Value builtin_log(const Context *, const QVector<QString>&, const QVector<Value>
|
|||
if (args.size() == 2 && args[0].type == Value::NUMBER && args[1].type == Value::NUMBER)
|
||||
return Value(log(args[1].num) / log(args[0].num));
|
||||
if (args.size() == 1 && args[0].type == Value::NUMBER)
|
||||
return Value(log(args[0].num) / log(10));
|
||||
return Value(log(args[0].num) / log(10.0));
|
||||
return Value();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,7 +33,7 @@
|
|||
#include <QMouseEvent>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
#include <math.h>
|
||||
#include "mathc99.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#define FAR_FAR_AWAY 100000.0
|
||||
|
|
16
src/grid.h
16
src/grid.h
|
@ -2,8 +2,12 @@
|
|||
#define GRID_H_
|
||||
|
||||
#include <QHash>
|
||||
#include <math.h>
|
||||
#include "mathc99.h"
|
||||
#ifdef WIN32
|
||||
typedef __int64 int64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
const double GRID_COARSE = 0.001;
|
||||
|
@ -33,8 +37,9 @@ public:
|
|||
for (int64_t jy = iy - 1; jy <= iy + 1; jy++) {
|
||||
if (!db.contains(QPair<int64_t,int64_t>(jx, jy)))
|
||||
continue;
|
||||
if (abs(ix-jx) + abs(iy-jy) < dist) {
|
||||
dist = abs(ix-jx) + abs(iy-jy);
|
||||
int d = abs(int(ix-jx)) + abs(int(iy-jy));
|
||||
if (d < dist) {
|
||||
dist = d;
|
||||
ix = jx;
|
||||
iy = jy;
|
||||
}
|
||||
|
@ -92,8 +97,9 @@ public:
|
|||
for (int64_t jz = iz - 1; jz <= iz + 1; jz++) {
|
||||
if (!db.contains(QPair<QPair<int64_t,int64_t>,int64_t>(QPair<int64_t,int64_t>(jx, jy), jz)))
|
||||
continue;
|
||||
if (abs(ix-jx) + abs(iy-jy) + abs(iz-jz) < dist) {
|
||||
dist = abs(ix-jx) + abs(iy-jy) + abs(iz-jz);
|
||||
int d = abs(int(ix-jx)) + abs(int(iy-jy)) + abs(int(iz-jz));
|
||||
if (d < dist) {
|
||||
dist = d;
|
||||
ix = jx;
|
||||
iy = jy;
|
||||
iz = jz;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -158,13 +159,24 @@ PolySet *ImportNode::render_polyset(render_mode_e, class PolySetRenderer *) cons
|
|||
{
|
||||
f.read(80-5+4);
|
||||
while (1) {
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(push,1)
|
||||
#endif
|
||||
struct {
|
||||
float i, j, k;
|
||||
float x1, y1, z1;
|
||||
float x2, y2, z2;
|
||||
float x3, y3, z3;
|
||||
unsigned short acount;
|
||||
} __attribute__ ((packed)) data;
|
||||
}
|
||||
#ifdef __GNUC__
|
||||
__attribute__ ((packed))
|
||||
#endif
|
||||
data;
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
if (f.read((char*)&data, sizeof(data)) != sizeof(data))
|
||||
break;
|
||||
p->append_poly();
|
||||
|
|
12
src/lexer.l
12
src/lexer.l
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -31,6 +32,13 @@
|
|||
#include <QStack>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
|
||||
//isatty for visual c++
|
||||
#ifdef _MSC_VER
|
||||
int __cdecl _isatty(int _FileHandle);
|
||||
#define isatty _isatty
|
||||
#endif
|
||||
|
||||
QString* stringcontents;
|
||||
int lexerget_lineno(void);
|
||||
#ifdef __GNUC__
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -80,13 +81,6 @@
|
|||
#include <boost/lambda/bind.hpp>
|
||||
using namespace boost::lambda;
|
||||
|
||||
//for chdir
|
||||
#include <unistd.h>
|
||||
|
||||
// for stat()
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef ENABLE_CGAL
|
||||
|
||||
#if 1
|
||||
|
@ -127,7 +121,7 @@ static char helptitle[] =
|
|||
"OpenSCAD " QUOTED(OPENSCAD_VERSION) " (www.openscad.org)\n"
|
||||
"Visitor refactored version";
|
||||
static char copyrighttext[] =
|
||||
"Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>\n"
|
||||
"Copyright (C) 2009-2011 Marius Kintel <marius@kintel.net> and Clifford Wolf <clifford@clifford.at>\n"
|
||||
"\n"
|
||||
"This program is free software; you can redistribute it and/or modify"
|
||||
"it under the terms of the GNU General Public License as published by"
|
||||
|
@ -1009,10 +1003,8 @@ void MainWindow::pasteViewportRotation()
|
|||
void MainWindow::checkAutoReload()
|
||||
{
|
||||
QString new_stinfo;
|
||||
struct stat st;
|
||||
memset(&st, 0, sizeof(struct stat));
|
||||
stat(this->fileName.toAscii().data(), &st);
|
||||
new_stinfo.sprintf("%x.%x", (int)st.st_mtime, (int)st.st_size);
|
||||
QFileInfo finfo(this->fileName);
|
||||
new_stinfo = QString::number(finfo.size()) + QString::number(finfo.lastModified().toTime_t());
|
||||
if (new_stinfo != autoReloadInfo)
|
||||
actionReloadCompile();
|
||||
autoReloadInfo = new_stinfo;
|
||||
|
@ -1526,7 +1518,7 @@ static void renderGLviaCGAL(void *vp)
|
|||
glColor3f(col2.redF(), col2.greenF(), col2.blueF());
|
||||
|
||||
// Extract the boundary, including inner boundaries of the polygons
|
||||
for (fci_t fit = E.faces_begin(), fend = E.faces_end(); fit != fend; ++fit)
|
||||
for (fci_t fit = E.faces_begin(), facesend = E.faces_end(); fit != facesend; ++fit)
|
||||
{
|
||||
bool fset = false;
|
||||
double fx = 0.0, fy = 0.0;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#include "mathc99.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <algorithm>
|
||||
|
||||
double round(double a) {
|
||||
return a > 0 ? floor(a+0.5) : ceil(a-0.5);
|
||||
}
|
||||
|
||||
float fmin(float a, float b) {
|
||||
return std::min(a,b);
|
||||
}
|
||||
|
||||
float fmax(float a, float b) {
|
||||
return std::max(a,b);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef MATHC99_H_
|
||||
#define MATHC99_H_
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#include <cmath>
|
||||
//for native win32 builds we need to provide C99 math functions by ourselves
|
||||
double round(double a);
|
||||
float fmin(float a, float b);
|
||||
float fmax(float a, float b);
|
||||
|
||||
#else
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -39,7 +40,7 @@ DxfData::DxfData(const struct CGAL_Nef_polyhedron &N)
|
|||
typedef Explorer::Halfedge_around_face_const_circulator heafcc_t;
|
||||
Explorer E = N.p2.explorer();
|
||||
|
||||
for (fci_t fit = E.faces_begin(), fend = E.faces_end(); fit != fend; ++fit)
|
||||
for (fci_t fit = E.faces_begin(), facesend = E.faces_end(); fit != facesend; ++fit)
|
||||
{
|
||||
heafcc_t fcirc(E.halfedge(fit)), fend(fcirc);
|
||||
int first_point = -1, last_point = -1;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
192
src/openscad.cc
192
src/openscad.cc
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -36,6 +37,9 @@
|
|||
#include "PolySetCGALRenderer.h"
|
||||
#include "printutils.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef ENABLE_CGAL
|
||||
#include "cgal.h"
|
||||
#include <CGAL/assertions_behaviour.h>
|
||||
|
@ -47,18 +51,24 @@
|
|||
#include <QSet>
|
||||
#include <QSettings>
|
||||
#include <QTextStream>
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include <getopt.h>
|
||||
#ifdef Q_WS_MAC
|
||||
#include "EventFilter.h"
|
||||
#include "AppleEvents.h"
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
namespace po = boost::program_options;
|
||||
|
||||
static void help(const char *progname)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s [ { -s stl_file | -o off_file | -x dxf_file } [ -d deps_file ] ]\\\n"
|
||||
"%*s[ -m make_command ] [ -D var=val [..] ] filename\n",
|
||||
progname, int(strlen(progname))+8, "");
|
||||
"%*s[ -m make_command ] [ -D var=val [..] ] filename\n",
|
||||
progname, int(strlen(progname))+8, "");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -77,6 +87,9 @@ QString currentdir;
|
|||
QString examplesdir;
|
||||
QString librarydir;
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
void handle_dep(QString filename)
|
||||
{
|
||||
if (filename.startsWith("/"))
|
||||
|
@ -128,76 +141,78 @@ int main(int argc, char **argv)
|
|||
const char *off_output_file = NULL;
|
||||
const char *dxf_output_file = NULL;
|
||||
const char *deps_output_file = NULL;
|
||||
|
||||
po::options_description desc("Allowed options");
|
||||
desc.add_options()
|
||||
("help,h", "help message")
|
||||
("version,v", "print the version")
|
||||
("s", po::value<string>(), "stl-file")
|
||||
("o", po::value<string>(), "off-file")
|
||||
("x", po::value<string>(), "dxf-file")
|
||||
("d", po::value<string>(), "deps-file")
|
||||
("m", po::value<string>(), "makefile")
|
||||
("D", po::value<vector<string> >(), "var=val");
|
||||
|
||||
po::options_description hidden("Hidden options");
|
||||
hidden.add_options()
|
||||
("input-file", po::value< vector<string> >(), "input file");
|
||||
|
||||
po::positional_options_description p;
|
||||
p.add("input-file", -1);
|
||||
|
||||
po::options_description all_options;
|
||||
all_options.add(desc).add(hidden);
|
||||
|
||||
po::variables_map vm;
|
||||
po::store(po::command_line_parser(argc, argv).options(all_options).positional(p).run(), vm);
|
||||
// po::notify(vm);
|
||||
|
||||
static struct option long_options[] =
|
||||
{
|
||||
{"version", no_argument, 0, 'v'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
int option_index = 0;
|
||||
|
||||
int opt;
|
||||
while ((opt = getopt_long(argc, argv, "s:o:x:d:m:D:vh", long_options, &option_index)) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 0:
|
||||
switch (option_index)
|
||||
{
|
||||
case 'v':
|
||||
version();
|
||||
break;
|
||||
case 'h':
|
||||
help(argv[0]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
version();
|
||||
break;
|
||||
case 'h':
|
||||
if (vm.count("help")) help(argv[0]);
|
||||
if (vm.count("version")) version();
|
||||
|
||||
if (vm.count("s")) {
|
||||
if (stl_output_file || off_output_file || dxf_output_file)
|
||||
help(argv[0]);
|
||||
break;
|
||||
case 's':
|
||||
if (stl_output_file || off_output_file || dxf_output_file)
|
||||
help(argv[0]);
|
||||
stl_output_file = optarg;
|
||||
break;
|
||||
case 'o':
|
||||
if (stl_output_file || off_output_file || dxf_output_file)
|
||||
help(argv[0]);
|
||||
off_output_file = optarg;
|
||||
break;
|
||||
case 'x':
|
||||
if (stl_output_file || off_output_file || dxf_output_file)
|
||||
help(argv[0]);
|
||||
dxf_output_file = optarg;
|
||||
break;
|
||||
case 'd':
|
||||
if (deps_output_file)
|
||||
help(argv[0]);
|
||||
deps_output_file = optarg;
|
||||
break;
|
||||
case 'm':
|
||||
if (make_command)
|
||||
help(argv[0]);
|
||||
make_command = optarg;
|
||||
break;
|
||||
case 'D':
|
||||
commandline_commands += QString(optarg) + QString(";\n");
|
||||
break;
|
||||
default:
|
||||
stl_output_file = vm["s"].as<string>().c_str();
|
||||
}
|
||||
if (vm.count("o")) {
|
||||
if (stl_output_file || off_output_file || dxf_output_file)
|
||||
help(argv[0]);
|
||||
off_output_file = vm["o"].as<string>().c_str();
|
||||
}
|
||||
if (vm.count("x")) {
|
||||
if (stl_output_file || off_output_file || dxf_output_file)
|
||||
help(argv[0]);
|
||||
dxf_output_file = vm["x"].as<string>().c_str();
|
||||
}
|
||||
if (vm.count("d")) {
|
||||
if (deps_output_file)
|
||||
help(argv[0]);
|
||||
deps_output_file = vm["d"].as<string>().c_str();
|
||||
}
|
||||
if (vm.count("m")) {
|
||||
if (make_command)
|
||||
help(argv[0]);
|
||||
make_command = vm["m"].as<string>().c_str();
|
||||
}
|
||||
|
||||
if (vm.count("D")) {
|
||||
const vector<string> &commands = vm["D"].as<vector<string> >();
|
||||
|
||||
for (vector<string>::const_iterator i = commands.begin(); i != commands.end(); i++) {
|
||||
commandline_commands.append(i->c_str());
|
||||
commandline_commands.append(";\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (optind < argc)
|
||||
filename = argv[optind++];
|
||||
if (vm.count("input-file")) {
|
||||
filename = vm["input-file"].as< vector<string> >().begin()->c_str();
|
||||
}
|
||||
|
||||
#ifndef ENABLE_MDI
|
||||
if (optind != argc)
|
||||
if (vm.count("input-file") > 1) {
|
||||
help(argv[0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
currentdir = QDir::currentPath();
|
||||
|
@ -210,16 +225,16 @@ int main(int argc, char **argv)
|
|||
if (exdir.cd("../share/openscad/examples")) {
|
||||
examplesdir = exdir.path();
|
||||
} else
|
||||
if (exdir.cd("../../share/openscad/examples")) {
|
||||
examplesdir = exdir.path();
|
||||
} else
|
||||
if (exdir.cd("../../examples")) {
|
||||
examplesdir = exdir.path();
|
||||
} else
|
||||
if (exdir.cd("../../share/openscad/examples")) {
|
||||
examplesdir = exdir.path();
|
||||
} else
|
||||
if (exdir.cd("../../examples")) {
|
||||
examplesdir = exdir.path();
|
||||
} else
|
||||
#endif
|
||||
if (exdir.cd("examples")) {
|
||||
examplesdir = exdir.path();
|
||||
}
|
||||
if (exdir.cd("examples")) {
|
||||
examplesdir = exdir.path();
|
||||
}
|
||||
|
||||
QDir libdir(QApplication::instance()->applicationDirPath());
|
||||
#ifdef Q_WS_MAC
|
||||
|
@ -229,16 +244,16 @@ int main(int argc, char **argv)
|
|||
if (libdir.cd("../share/openscad/libraries")) {
|
||||
librarydir = libdir.path();
|
||||
} else
|
||||
if (libdir.cd("../../share/openscad/libraries")) {
|
||||
librarydir = libdir.path();
|
||||
} else
|
||||
if (libdir.cd("../../libraries")) {
|
||||
librarydir = libdir.path();
|
||||
} else
|
||||
if (libdir.cd("../../share/openscad/libraries")) {
|
||||
librarydir = libdir.path();
|
||||
} else
|
||||
if (libdir.cd("../../libraries")) {
|
||||
librarydir = libdir.path();
|
||||
} else
|
||||
#endif
|
||||
if (libdir.cd("libraries")) {
|
||||
librarydir = libdir.path();
|
||||
}
|
||||
if (libdir.cd("libraries")) {
|
||||
librarydir = libdir.path();
|
||||
}
|
||||
|
||||
// Initialize global visitors
|
||||
NodeCache nodecache;
|
||||
|
@ -378,8 +393,13 @@ int main(int argc, char **argv)
|
|||
#endif
|
||||
#ifdef ENABLE_MDI
|
||||
new MainWindow(qfilename);
|
||||
while (optind < argc)
|
||||
new MainWindow(QFileInfo(original_path, argv[optind++]).absoluteFilePath());
|
||||
vector<string> inputFiles;
|
||||
if (vm.count("input-file")) {
|
||||
inputFiles = vm["input-file"].as<vector<string> >();
|
||||
for (vector<string>::const_iterator i = inputFiles.begin()+1; i != inputFiles.end(); i++) {
|
||||
new MainWindow(QFileInfo(original_path, i->c_str()).absoluteFilePath());
|
||||
}
|
||||
}
|
||||
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
|
||||
#else
|
||||
MainWindow *m = new MainWindow(qfilename);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -34,7 +35,9 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "module.h"
|
||||
#include "expression.h"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -143,7 +144,7 @@ void PolySet::render_surface(colormode_e colormode, csgmode_e csgmode, double *m
|
|||
#ifdef ENABLE_OPENCSG
|
||||
if (shaderinfo) {
|
||||
glUniform4f(shaderinfo[1], col.redF(), col.greenF(), col.blueF(), 1.0f);
|
||||
glUniform4f(shaderinfo[2], 255 / 255.0, 236 / 255.0, 94 / 255.0, 1.0);
|
||||
glUniform4f(shaderinfo[2], 255 / 255.0f, 236 / 255.0f, 94 / 255.0f, 1.0f);
|
||||
}
|
||||
#endif /* ENABLE_OPENCSG */
|
||||
}
|
||||
|
@ -154,8 +155,8 @@ void PolySet::render_surface(colormode_e colormode, csgmode_e csgmode, double *m
|
|||
glColor3f(col.redF(), col.greenF(), col.blueF());
|
||||
#ifdef ENABLE_OPENCSG
|
||||
if (shaderinfo) {
|
||||
glUniform4f(shaderinfo[1], 157 / 255.0, 203 / 255.0, 81 / 255.0, 1.0);
|
||||
glUniform4f(shaderinfo[2], 171 / 255.0, 216 / 255.0, 86 / 255.0, 1.0);
|
||||
glUniform4f(shaderinfo[1], 157 / 255.0f, 203 / 255.0f, 81 / 255.0f, 1.0f);
|
||||
glUniform4f(shaderinfo[2], 171 / 255.0f, 216 / 255.0f, 86 / 255.0f, 1.0f);
|
||||
}
|
||||
#endif /* ENABLE_OPENCSG */
|
||||
}
|
||||
|
@ -163,8 +164,8 @@ void PolySet::render_surface(colormode_e colormode, csgmode_e csgmode, double *m
|
|||
glColor4ub(255, 157, 81, 128);
|
||||
#ifdef ENABLE_OPENCSG
|
||||
if (shaderinfo) {
|
||||
glUniform4f(shaderinfo[1], 255 / 255.0, 157 / 255.0, 81 / 255.0, 0.5);
|
||||
glUniform4f(shaderinfo[2], 255 / 255.0, 171 / 255.0, 86 / 255.0, 0.5);
|
||||
glUniform4f(shaderinfo[1], 255 / 255.0f, 157 / 255.0f, 81 / 255.0f, 0.5f);
|
||||
glUniform4f(shaderinfo[2], 255 / 255.0f, 171 / 255.0f, 86 / 255.0f, 0.5f);
|
||||
}
|
||||
#endif /* ENABLE_OPENCSG */
|
||||
}
|
||||
|
@ -172,8 +173,8 @@ void PolySet::render_surface(colormode_e colormode, csgmode_e csgmode, double *m
|
|||
glColor4ub(180, 180, 180, 128);
|
||||
#ifdef ENABLE_OPENCSG
|
||||
if (shaderinfo) {
|
||||
glUniform4f(shaderinfo[1], 180 / 255.0, 180 / 255.0, 180 / 255.0, 0.5);
|
||||
glUniform4f(shaderinfo[2], 150 / 255.0, 150 / 255.0, 150 / 255.0, 0.5);
|
||||
glUniform4f(shaderinfo[1], 180 / 255.0f, 180 / 255.0f, 180 / 255.0f, 0.5f);
|
||||
glUniform4f(shaderinfo[2], 150 / 255.0f, 150 / 255.0f, 150 / 255.0f, 0.5f);
|
||||
}
|
||||
#endif /* ENABLE_OPENCSG */
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -93,6 +94,7 @@ public:
|
|||
|
||||
bool center;
|
||||
double x, y, z, h, r1, r2;
|
||||
static const double F_MINIMUM = 0.01;
|
||||
double fn, fs, fa;
|
||||
primitive_type_e type;
|
||||
int convexity;
|
||||
|
@ -143,6 +145,16 @@ AbstractNode *PrimitiveModule::evaluate(const Context *ctx, const ModuleInstanti
|
|||
node->fs = c.lookup_variable("$fs").num;
|
||||
node->fa = c.lookup_variable("$fa").num;
|
||||
|
||||
if (node->fs < PrimitiveNode::F_MINIMUM) {
|
||||
PRINTF("WARNING: $fs too small - clamping to %f", PrimitiveNode::F_MINIMUM);
|
||||
node->fs = PrimitiveNode::F_MINIMUM;
|
||||
}
|
||||
if (node->fa < PrimitiveNode::F_MINIMUM) {
|
||||
PRINTF("WARNING: $fa too small - clamping to %f", PrimitiveNode::F_MINIMUM);
|
||||
node->fa = PrimitiveNode::F_MINIMUM;
|
||||
}
|
||||
|
||||
|
||||
if (type == CUBE) {
|
||||
Value size = c.lookup_variable("size");
|
||||
Value center = c.lookup_variable("center");
|
||||
|
@ -317,7 +329,7 @@ PolySet *PrimitiveNode::render_polyset(render_mode_e, class PolySetRenderer *) c
|
|||
};
|
||||
|
||||
int rings = get_fragments_from_r(this->r1, this->fn, this->fs, this->fa);
|
||||
ring_s ring[rings];
|
||||
ring_s *ring = new ring_s[rings];
|
||||
|
||||
for (int i = 0; i < rings; i++) {
|
||||
double phi = (M_PI * (i + 0.5)) / rings;
|
||||
|
@ -370,6 +382,8 @@ sphere_next_r2:
|
|||
p->append_poly();
|
||||
for (int i = 0; i < ring[rings-1].fragments; i++)
|
||||
p->insert_vertex(ring[rings-1].points[i].x, ring[rings-1].points[i].y, ring[rings-1].z);
|
||||
|
||||
delete[] ring;
|
||||
}
|
||||
|
||||
if (this->type == CYLINDER &&
|
||||
|
@ -390,8 +404,8 @@ sphere_next_r2:
|
|||
double x, y;
|
||||
};
|
||||
|
||||
point2d circle1[fragments];
|
||||
point2d circle2[fragments];
|
||||
point2d *circle1 = new point2d[fragments];
|
||||
point2d *circle2 = new point2d[fragments];
|
||||
|
||||
for (int i=0; i<fragments; i++) {
|
||||
double phi = (M_PI*2*i) / fragments;
|
||||
|
@ -438,6 +452,9 @@ sphere_next_r2:
|
|||
for (int i=0; i<fragments; i++)
|
||||
p->append_vertex(circle2[i].x, circle2[i].y, z2);
|
||||
}
|
||||
|
||||
delete[] circle1;
|
||||
delete[] circle2;
|
||||
}
|
||||
|
||||
if (this->type == POLYHEDRON)
|
||||
|
@ -483,22 +500,13 @@ sphere_next_r2:
|
|||
{
|
||||
int fragments = get_fragments_from_r(this->r1, this->fn, this->fs, this->fa);
|
||||
|
||||
struct point2d {
|
||||
double x, y;
|
||||
};
|
||||
|
||||
point2d circle[fragments];
|
||||
|
||||
for (int i=0; i<fragments; i++) {
|
||||
double phi = (M_PI*2*i) / fragments;
|
||||
circle[i].x = this->r1*cos(phi);
|
||||
circle[i].y = this->r1*sin(phi);
|
||||
}
|
||||
|
||||
p->is2d = true;
|
||||
p->append_poly();
|
||||
for (int i=0; i<fragments; i++)
|
||||
p->append_vertex(circle[i].x, circle[i].y);
|
||||
|
||||
for (int i=0; i < fragments; i++) {
|
||||
double phi = (M_PI*2*i) / fragments;
|
||||
p->append_vertex(this->r1*cos(phi), this->r1*sin(phi));
|
||||
}
|
||||
}
|
||||
|
||||
if (this->type == POLYGON)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -41,9 +42,6 @@
|
|||
# include <CGAL/exceptions.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
#include <sstream>
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -24,7 +25,7 @@
|
|||
*/
|
||||
|
||||
#include "value.h"
|
||||
#include <math.h>
|
||||
#include "mathc99.h"
|
||||
#include <assert.h>
|
||||
#include <sstream>
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
hull() {
|
||||
translate([15,10,0])
|
||||
circle(10);
|
||||
circle(10);
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* OpenSCAD (www.openscad.at)
|
||||
* Copyright (C) 2009 Clifford Wolf <clifford@clifford.at>
|
||||
* OpenSCAD (www.openscad.org)
|
||||
* Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and
|
||||
* Marius Kintel <marius@kintel.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
Loading…
Reference in New Issue