diff --git a/src/Roassal3-Examples/RSdeCasteljauExamples.class.st b/src/Roassal3-Examples/RSdeCasteljauExamples.class.st index 0447eed5f..408ee0954 100644 --- a/src/Roassal3-Examples/RSdeCasteljauExamples.class.st +++ b/src/Roassal3-Examples/RSdeCasteljauExamples.class.st @@ -10,9 +10,9 @@ Class { } { #category : 'lines' } -RSdeCasteljauExamples >> example01deCasteljauLine [ +RSdeCasteljauExamples >> example44deCasteljauLine [ - + | points | points := { (1 @ 0). diff --git a/src/Roassal3-Layouts/RSParametricLine.extension.st b/src/Roassal3-Layouts/RSParametricLine.extension.st new file mode 100644 index 000000000..55a396e6a --- /dev/null +++ b/src/Roassal3-Layouts/RSParametricLine.extension.st @@ -0,0 +1,81 @@ +Extension { #name : 'RSParametricLine' } + +{ #category : '*Roassal3-Layouts' } +RSParametricLine >> asGroupWithControlNet: aBlock [ + + | circles polyline labels location | + polyline := RSPolyline new + controlPoints: points; + dotted; + yourself. + + circles := Array new: pointsSize. + labels := Array new: pointsSize. + + location := RSLocation new + above; + yourself. + + points withIndexCollect: [ :each :index | + | circle label | + circle := RSCircle new + model: each; + color: Color transparent; + radius: polyline border width * Float goldenPlatinumRatio; + draggable; + withBorder; + position: each; + yourself. + + label := RSLabel new + useDefaultCodeFont; + text: (circle position asFloatPointRound: 3); + yourself. + + location stick: label on: circle. + + circle + when: RSPositionChangedEvent + do: [ :ev | + circle model: ev newPosition. + label text: (ev newPosition asFloatPointRound: 3). + + points at: index put: ev newPosition. + polyline controlPoints: points. + + self controlPoints: points ] + for: self. + + + circles at: index put: circle. + labels at: index put: label ]. + + polyline color: polyline color translucent. + self color: self color translucent. + + aBlock + value: self + value: circles + value: labels + value: polyline. + + ^ RSGroup new + addAll: circles , labels , { + polyline. + self }; + yourself +] + +{ #category : '*Roassal3-Layouts' } +RSParametricLine >> asGroupWithControlNetColoured: aColor [ + + ^ self asGroupWithControlNet: [ :bspline :circles :labels :line | + | translucentColor | + translucentColor := aColor translucent. + + bspline color: aColor. + line color: translucentColor. + circles with: labels do: [ :circle :label | + circle border color: translucentColor. + label color: translucentColor ] ] +] diff --git a/src/Roassal3-Layouts/RSShape.extension.st b/src/Roassal3-Layouts/RSShape.extension.st new file mode 100644 index 000000000..6bec719cb --- /dev/null +++ b/src/Roassal3-Layouts/RSShape.extension.st @@ -0,0 +1,72 @@ +Extension { #name : 'RSShape' } + +{ #category : '*Roassal3-Layouts' } +RSShape >> boxedWithPad: aPadding [ + + ^ self padded: aPadding withBoxDo: [ :box | + box + color: Color white; + borderDo: [ :aBorder | aBorder color: aBorder color translucent ] ] +] + +{ #category : '*Roassal3-Layouts' } +RSShape >> notedWithPad: aPadding [ + + ^ self padded: aPadding withNoteDo: [ :box | + box + color: Color white; + borderDo: [ :aBorder | aBorder color: aBorder color translucent ] ] +] + +{ #category : '*Roassal3-Layouts' } +RSShape >> padded: aPadding shape: boxShape do: aBlock [ + + | box | + box := boxShape + extent: self extent + (aPadding * 2); + cornerRadius: aPadding; + yourself. + + aBlock cull: box cull: self. + + RSLocation new + center; + stick: box on: self. + + ^ RSComposite new + shapes: { + box. + self }; + yourself +] + +{ #category : '*Roassal3-Layouts' } +RSShape >> padded: aPadding withBoxDo: aBlock [ + + ^ self padded: aPadding shape: RSBox new do: aBlock +] + +{ #category : '*Roassal3-Layouts' } +RSShape >> padded: aPadding withNoteDo: aBlock [ + + ^ self padded: aPadding shape: RSNote new do: aBlock +] + +{ #category : '*Roassal3-Layouts' } +RSShape >> padded: aPadding withSimplerNoteDo: aBlock [ + + ^ self padded: aPadding shape: RSSimplerNote new do: aBlock +] + +{ #category : '*Roassal3-Layouts' } +RSShape >> paddedWithGoldenRatio [ + + | pad | + pad := self extent * Float silverRatio / 2 in: [ :extent | + extent x max: extent y ]. + + ^ RSComposite new + shapes: { self }; + padding: pad; + yourself +] diff --git a/src/Roassal3-Shapes-Tests/RSPLinesTest.class.st b/src/Roassal3-Shapes-Tests/RSPLinesTest.class.st index 95a6cc3b4..4d08bb434 100644 --- a/src/Roassal3-Shapes-Tests/RSPLinesTest.class.st +++ b/src/Roassal3-Shapes-Tests/RSPLinesTest.class.st @@ -11,12 +11,13 @@ Class { { #category : 'building suites' } RSPLinesTest class >> testParameters [ + | m classesToConsider | m := ParametrizedTestMatrix new. - classesToConsider := RSAbstractLine allSubclasses select: [ :c | c isAbstract not ]. - classesToConsider do: [ :cls | - m addCase: { (#shapeClass -> cls) } - ]. + classesToConsider := RSAbstractLine allSubclasses select: [ :c | + (c isAbstract or: [ c = RSSegmentedPolyline ]) + not ]. + classesToConsider do: [ :cls | m addCase: { (#shapeClass -> cls) } ]. ^ m ] diff --git a/src/Roassal3-Shapes/RSParametricLine.class.st b/src/Roassal3-Shapes/RSParametricLine.class.st index a9b52a269..fdb8bdc8a 100644 --- a/src/Roassal3-Shapes/RSParametricLine.class.st +++ b/src/Roassal3-Shapes/RSParametricLine.class.st @@ -13,6 +13,12 @@ Class { #tag : 'Lines' } +{ #category : 'testing' } +RSParametricLine class >> isAbstract [ + + ^ true +] + { #category : 'accessing' } RSParametricLine >> arcLengthParameterization [ @@ -25,86 +31,6 @@ RSParametricLine >> asGroupWithControlNet [ ^ self asGroupWithControlNetColoured: Color gray ] -{ #category : 'converting' } -RSParametricLine >> asGroupWithControlNet: aBlock [ - - | circles polyline labels location | - polyline := RSPolyline new - controlPoints: points; - dotted; - yourself. - - circles := Array new: pointsSize. - labels := Array new: pointsSize. - - location := RSLocation new - above; - yourself. - - points withIndexCollect: [ :each :index | - | circle label | - circle := RSCircle new - model: each; - color: Color transparent; - radius: polyline border width * Float goldenPlatinumRatio; - draggable; - withBorder; - position: each; - yourself. - - label := RSLabel new - useDefaultCodeFont; - text: (circle position asFloatPointRound: 3); - yourself. - - location stick: label on: circle. - - circle - when: RSPositionChangedEvent - do: [ :ev | - circle model: ev newPosition. - label text: (ev newPosition asFloatPointRound: 3). - - points at: index put: ev newPosition. - polyline controlPoints: points. - - self controlPoints: points ] - for: self. - - - circles at: index put: circle. - labels at: index put: label ]. - - polyline color: polyline color translucent. - self color: self color translucent. - - aBlock - value: self - value: circles - value: labels - value: polyline. - - ^ RSGroup new - addAll: circles , labels , { - polyline. - self }; - yourself -] - -{ #category : 'converting' } -RSParametricLine >> asGroupWithControlNetColoured: aColor [ - - ^ self asGroupWithControlNet: [ :bspline :circles :labels :line | - | translucentColor | - translucentColor := aColor translucent. - - bspline color: aColor. - line color: translucentColor. - circles with: labels do: [ :circle :label | - circle border color: translucentColor. - label color: translucentColor ] ] -] - { #category : 'accessing' } RSParametricLine >> controlPoints: aSequenceableOfPoints [ diff --git a/src/Roassal3/RSShape.class.st b/src/Roassal3/RSShape.class.st index e9f9a9b71..a63031466 100644 --- a/src/Roassal3/RSShape.class.st +++ b/src/Roassal3/RSShape.class.st @@ -505,68 +505,6 @@ RSShape >> noPaint [ paint := nil ] -{ #category : 'padding' } -RSShape >> notedWithPad: aPadding [ - - ^ self padded: aPadding withNoteDo: [ :box | - box - color: Color white; - borderDo: [ :aBorder | aBorder color: aBorder color translucent ] ] -] - -{ #category : 'padding' } -RSShape >> padded: aPadding shape: boxShape do: aBlock [ - - | box | - box := boxShape - extent: self extent + (aPadding * 2); - cornerRadius: aPadding; - yourself. - - aBlock cull: box cull: self. - - RSLocation new - center; - stick: box on: self. - - ^ RSComposite new - shapes: { - box. - self }; - yourself -] - -{ #category : 'padding' } -RSShape >> padded: aPadding withBoxDo: aBlock [ - - ^ self padded: aPadding shape: RSBox new do: aBlock -] - -{ #category : 'padding' } -RSShape >> padded: aPadding withNoteDo: aBlock [ - - ^ self padded: aPadding shape: RSNote new do: aBlock -] - -{ #category : 'padding' } -RSShape >> padded: aPadding withSimplerNoteDo: aBlock [ - - ^ self padded: aPadding shape: RSSimplerNote new do: aBlock -] - -{ #category : 'padding' } -RSShape >> paddedWithGoldenRatio [ - - | pad | - pad := self extent * Float silverRatio / 2 in: [ :extent | - extent x max: extent y ]. - - ^ RSComposite new - shapes: { self }; - padding: pad; - yourself -] - { #category : 'accessing' } RSShape >> paint [ ^ paint diff --git a/src/Roassal3/RandomBoxMullerBivariateGaussian.class.st b/src/Roassal3/RandomBoxMullerBivariateGaussian.class.st index 423f94ac4..9a7b5b57e 100644 --- a/src/Roassal3/RandomBoxMullerBivariateGaussian.class.st +++ b/src/Roassal3/RandomBoxMullerBivariateGaussian.class.st @@ -9,25 +9,6 @@ Class { #tag : 'Random' } -{ #category : 'converting' } -RandomBoxMullerBivariateGaussian >> asShapeScatter [ - - | gen points | - gen := self copy. - points := ((1 to: 500) collect: [ :each1 | gen next ]) sorted. - - ^ RSComposite new shapes: (RSChart new - addPlot: (RSScatterPlot new - x: (points collect: [ :each | each x ]) - y: (points collect: [ :each | each y ]); - color: Color gray translucent; - yourself); - addDecoration: RSHorizontalTick new; - addDecoration: RSVerticalTick new; - build; - shapes) -] - { #category : 'accessing' } RandomBoxMullerBivariateGaussian >> density: x [