TPatch


Croquet-Teapot

Comment:

Used to generate and maintain Bezier patches. See TTeapot for its usage.

Hierarchy:

ProtoObject
Object
Collection
SequenceableCollection
ArrayedCollection
FloatArray
TPatch

Summary:

methods:

instance class
as yet unclassified as yet unclassified

Detail:

instance methods:

as yet unclassified
mirrorX

" answer a copy of the reciever where the patch is mirrored around the x-axis "
" reverse every four elements three member (vector) elements and negate the first (x) value."

	| n result |
	n _ self size.
	result _ self species new: n.
	1 to: n by: 12 do:[ :base | 
		0 to: 11 by: 3 do:[ :vindex | result at: base + (9 - vindex) put: (self at: base+vindex) negated.
									result at: base + (9 - vindex) + 1 put: (self at: base + vindex + 1).
									result at: base + (9 - vindex) + 2 put: (self at: base + vindex + 2)]].
	^ result.
mirrorY

" answer a copy of the reciever where the patch is mirrored around the y-axis "
" reverse every four elements three member (vector) elements and negate the second (y) value."

	| n result |
	n _ self size.
	result _ self species new: n.
	1 to: n by: 12 do:[ :base | 
		0 to: 11 by: 3 do:[ :vindex | result at: base + (9 - vindex) put: (self at: base+vindex).
									result at: base + (9 - vindex) + 1 put: (self at: base + vindex + 1) negated.
									result at: base + (9 - vindex) + 2 put: (self at: base + vindex + 2)]].
	^ result.
mirrorZ

" answer a copy of the reciever where the patch is mirrored around the z-axis "
" reverse every four elements three member (vector) elements and negate the second (z) value."

	| n result |
	n _ self size.
	result _ self species new: n.
	1 to: n by: 12 do:[ :base | 
		0 to: 11 by: 3 do:[ :vindex | result at: base + (9 - vindex) put: (self at: base+vindex).
									result at: base + (9 - vindex) + 1 put: (self at: base + vindex + 1) .
									result at: base + (9 - vindex) + 2 put: (self at: base + vindex + 2) negated]].
	^ result.
patch: patch vertex: vert


patch doWithIndex: 
	[:pIndex :index || i j | 
		i _  (index-1) * 3.
		j _ pIndex * 3. 
		1 to: 3 do: [:k |
			self at: i+k put: (vert at: j+k).]]

class methods:

as yet unclassified
new

	^self ofSize: 4*4*3.

^top


- made by Dandelion -