Skip to content

Commit

Permalink
add gridscale parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu committed Nov 20, 2021
1 parent 7cc895c commit ae19cf3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PlutoVista"
uuid = "646e1f28-b900-46d7-9d87-d554eb38a413"
authors = ["Juergen Fuhrmann <[email protected]>"]
version = "0.8.11"
version = "0.8.12"

[deps]
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
Expand Down
18 changes: 18 additions & 0 deletions assets/plutovtkplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,21 @@ function plutovtkplot(uuid,jsdict,invalidation)
var isopoints=jsdict[cmd+"isopoints"]
var isolines=jsdict[cmd+"isolines"]
var colors=jsdict[cmd+"colors"]
var gridscale=jsdict[cmd+"gridscale"]


vtk.Common.Core.vtkMatrixBuilder
.buildFromRadian()
.scale(gridscale,gridscale,gridscale)
.apply(points);

vtk.Common.Core.vtkMatrixBuilder
.buildFromRadian()
.scale(gridscale,gridscale,gridscale)
.apply(isopoints);



{ // Gouraud shaded triangles
if (win.color_triangle_dataset == undefined)
{
Expand Down Expand Up @@ -325,12 +339,15 @@ function plutovtkplot(uuid,jsdict,invalidation)
var polys=jsdict[cmd+"polys"]
var colors=jsdict[cmd+"colors"]
var lines=jsdict[cmd+"lines"]
var gridscale=jsdict[cmd+"gridscale"]
var linecolors=jsdict[cmd+"linecolors"]
zshift=zshift*gridscale

var zshift=points[3]
vtk.Common.Core.vtkMatrixBuilder
.buildFromRadian()
.translate(0,0,-zshift)
.scale(gridscale,gridscale,gridscale)
.apply(points);


Expand Down Expand Up @@ -415,6 +432,7 @@ function plutovtkplot(uuid,jsdict,invalidation)
win.cubeAxes = vtk.Rendering.Core.vtkCubeAxesActor.newInstance();
win.renderer.addActor(win.cubeAxes);


win.interactor.initialize();
setinteractorstyle(win.interactor,camstyle)

Expand Down
5 changes: 4 additions & 1 deletion src/plutovtkplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Isolines can be given as a number or as a range.
"""
function tricontour!(p::PlutoVTKPlot, pts, tris,f;kwargs...)

default_args=(colormap=:viridis, levels=0, limits=:auto)
default_args=(colormap=:viridis, levels=0, limits=:auto,gridscale=1.0)
args=merge(p.args,default_args)
args=merge(args,kwargs)

Expand All @@ -201,6 +201,7 @@ function tricontour!(p::PlutoVTKPlot, pts, tris,f;kwargs...)

parameter!(p,"points",vec(vcat(pts,zeros(eltype(pts),length(f))')))
parameter!(p,"polys",vtkpolys(tris))
parameter!(p,"gridscale",args[:gridscale])

rgb=reinterpret(Float64,Base.get(colorschemes[colormap],f,crange))
parameter!(p,"colors",UInt8.(floor.(rgb*255)))
Expand Down Expand Up @@ -391,6 +392,7 @@ function trimesh!(p::PlutoVTKPlot,pts, tris; kwargs...)
default_args=(markers=nothing,
colormap=nothing,
edges=nothing,
gridscale=1.0,
edgemarkers=nothing,
edgecolormap=nothing)

Expand All @@ -413,6 +415,7 @@ function trimesh!(p::PlutoVTKPlot,pts, tris; kwargs...)

parameter!(p,"points",vec(vcat(pts,zcoord')))
parameter!(p,"polys",vtkpolys(tris))
parameter!(p,"gridscale",args[:gridscale])



Expand Down

2 comments on commit ae19cf3

@j-fu
Copy link
Owner Author

@j-fu j-fu commented on ae19cf3 Nov 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/49096

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.8.12 -m "<description of version>" ae19cf31cec4290ce36739aa874424ad3fd00d19
git push origin v0.8.12

Please sign in to comment.