コード例 #1
0
    - oldSnapshotIndex is valid only within the call of func, it can change
  setClearableProperty(name, clearable=True)
    - clearable property is set to None after every snapshot, the others are always inherited
  set_maxcount(count)
  get_maxcount()
    - gets/sets the maximum number of snapshots

uses modules: [helpMod]

For more information see snapshots.py
"""

try:
	import helpMod
	helpMod.addModule("snapshots", module_help)
	helpMod.addPage("undo", module_help)
	helpMod.addPage("redo", module_help)
	helpMod.addPage("snapshots", module_help)
except ImportError:
	pass

import gf
from time import time
snapshots=[dict()]
currentIndex=0

currentState=dict()
restoreCallbacks=set()
createCallbacks=set()
uncommittedChanges=False
restoring=False
コード例 #2
0
uses modules: [gfUtils], [helpMod], [randomRot] (deactivates auto)

For more information see spaceNavigator.py
"""

import gf
import os
import struct
import threading
import time  # gf.time can be used only in the main thread

try:
    import helpMod
    helpMod.addModule("spacenavigator", module_help)
    helpMod.addPage("spacenavigator", module_help)
except ImportError:
    pass

device = "/dev/input/spacenavigator"
lock = threading.Lock()
buttons = []
sensitivity = 0.01
idleTime = 0
axes = None
try:
    import gfUtils

    def leftBtnFunc():
        gfUtils.openFileRelative(-1)
コード例 #3
0
  set_auto(bool_value)          -enables/disables automatic rotation
  randomRot(allowCameraMoving)  -rotation itself

uses modules: [helpMod]

For more information see randomRot.py
"""

import gf
import random
random.seed()

try:
    import helpMod
    helpMod.addModule("randomrot", module_help)
    helpMod.addPage("randomrot", module_help)
except ImportError:
    pass

mappedTo = None


def map(key):
    global mappedTo
    if mappedTo:
        gf.map(mappedTo)
    if key:
        gf.map(key, "randomRot.randomRot()")
    mappedTo = key

コード例 #4
0
For more information see figureInfo.py
"""

import gf
import os
import pprint
import objFigure

try: import snapshots
except ImportError: snapshots=None

try:
	import helpMod
	helpMod.addModule("figureinfo", module_help)
	helpMod.addPage("info", module_help)
except ImportError:
	pass

name=None
description=None
filePath=None
modified=False

def onNew():
	if snapshots and snapshots.restoringInProgress():
		return
	global name
	global description
	global filePath
	global modified
コード例 #5
0
    - oldSnapshotIndex is valid only within the call of func, it can change
  setClearableProperty(name, clearable=True)
    - clearable property is set to None after every snapshot, the others are always inherited
  set_maxcount(count)
  get_maxcount()
    - gets/sets the maximum number of snapshots

uses modules: [helpMod]

For more information see snapshots.py
"""

try:
    import helpMod
    helpMod.addModule("snapshots", module_help)
    helpMod.addPage("undo", module_help)
    helpMod.addPage("redo", module_help)
    helpMod.addPage("snapshots", module_help)
except ImportError:
    pass

import gf
from time import time
snapshots = [dict()]
currentIndex = 0

currentState = dict()
restoreCallbacks = set()
createCallbacks = set()
uncommittedChanges = False
restoring = False
コード例 #6
0
For more information see stellation.py
"""

import spaceCuts
import algebra
import objFigure
from operator import attrgetter
import gf
try: import figureInfo
except ImportError: figureInfo=None

try:
	import helpMod
	helpMod.addModule("stellation", module_help)
	helpMod.addPage("stellate", module_help)
except ImportError:
	pass

def stellateFigure(figure):
	objFigure.updateVerticesLists(figure)
	objFigure.updateParentsLists(figure)
	innerPoint=algebra.vectAvg(*[v.position for v in figure.vertices])

	for f in figure.boundary:
		f.hyperplane=spaceCuts.hyperplaneOfFacet(f, innerPoint);
		f.hyperplane.origFacet=f

	newFacets=[]
	for f in figure.boundary:
		facets=set()
コード例 #7
0
from objFigure import Figure, Vertex, figuresIterator;
import algebra
from algebra import Hyperplane;
import gf
import spaceCuts
import check

try:
	import figureInfo
except ImportError:
	figureInfo=None

try:
	import helpMod
	helpMod.addModule("cuts", module_help)
	helpMod.addPage("cut", module_help)
except ImportError:
	pass

# Cuts Figure object with given Hyperplane,
# returns ([Figure negative_parts], [Figure section_parts], [Figure positive_parts])
def cutFigure(wholeFigure, hyperplane):

	facesAscending=[]
	queue=[wholeFigure]
	mark=object()
	while queue:
		figure=queue.pop(0)
		if figure.mark==mark: continue
		figure.mark=mark
		facesAscending.insert(0,figure)
コード例 #8
0
"""

import gf
import os
import pprint
import objFigure

try:
    import snapshots
except ImportError:
    snapshots = None

try:
    import helpMod
    helpMod.addModule("figureinfo", module_help)
    helpMod.addPage("info", module_help)
except ImportError:
    pass

name = None
description = None
filePath = None
modified = False


def onNew():
    if snapshots and snapshots.restoringInProgress():
        return
    global name
    global description
    global filePath
コード例 #9
0
uses modules: [helpMod]

For more information see randomRot.py
"""

import gf
import random

random.seed()

try:
    import helpMod

    helpMod.addModule("randomrot", module_help)
    helpMod.addPage("randomrot", module_help)
except ImportError:
    pass

mappedTo = None


def map(key):
    global mappedTo
    if mappedTo:
        gf.map(mappedTo)
    if key:
        gf.map(key, "randomRot.randomRot()")
    mappedTo = key

コード例 #10
0
uses modules: [gfUtils], [helpMod], [randomRot] (deactivates auto)

For more information see spaceNavigator.py
"""

import gf
import os
import struct
import threading
import time # gf.time can be used only in the main thread

try:
	import helpMod
	helpMod.addModule("spacenavigator", module_help)
	helpMod.addPage("spacenavigator", module_help)
except ImportError:
	pass

device="/dev/input/spacenavigator"
lock=threading.Lock()
buttons=[]
sensitivity=0.01
idleTime=0
axes=None
try:
	import gfUtils
	def leftBtnFunc():
		gfUtils.openFileRelative(-1)
	def rightBtnFunc():
		gfUtils.openFileRelative(1)
コード例 #11
0
ファイル: duals.py プロジェクト: Zereges/geometric-figures
"""

import objFigure
from objFigure import Figure, Vertex
import gf
from operator import attrgetter
import algebra
import check

try: import figureInfo
except ImportError: figureInfo=None

try:
	import helpMod
	helpMod.addModule("duals", module_help)
	helpMod.addPage("create dual", module_help)
except ImportError:
	pass

def dualPointFromHyperplane(hyperplane, centerPoint=None):
	if not centerPoint:
		centerPoint=(0,)*len(hyperplane.normal)
	dist=hyperplane.orientedDistance(centerPoint)
	if abs(dist) < 0.0001:
		raise RuntimeError("Hyperplane passing through the center")
	return algebra.vectSum(algebra.vectMult(-1/dist, hyperplane.normal), centerPoint)

def createDual(figure, centerPoint=None):
	if figure.dim<2:
		raise RuntimeError("Figure has to have at least 2 dimensions")
	figureElem = sorted(figure, key=attrgetter('dim'), reverse=True)[1:]
コード例 #12
0
"""

import objFigure
from objFigure import Figure, Vertex
import gf
from operator import attrgetter
import algebra
import check

try: import figureInfo
except ImportError: figureInfo=None

try:
	import helpMod
	helpMod.addModule("duals", module_help)
	helpMod.addPage("create dual", module_help)
except ImportError:
	pass

def dualPointFromHyperplane(hyperplane, centerPoint=None):
	if not centerPoint:
		centerPoint=(0,)*len(hyperplane.normal)
	dist=hyperplane.orientedDistance(centerPoint)
	if abs(dist) < 0.0001:
		raise RuntimeError("Hyperplane passing through the center")
	return algebra.vectSum(algebra.vectMult(-1/dist, hyperplane.normal), centerPoint)

def createDual(figure, centerPoint=None):
	if figure.dim<2:
		raise RuntimeError("Figure has to have at least 2 dimensions")
	dualFigure=Figure()