Notifications
Clear all

[Closed] Point Cloud object C++

I was looking though the sdk docs about point cloud and there only looks like you can import an work with them. I’m guessing making a point cloud from an objects verts is not something max can do? Am I correct with this or did I miss something.

Thanks

2 Replies

pretty simple object for c++ and mxs

plugin simpleObject pointcloud
      	name:"pointcloud"
      	classID:#(0x68021925, 0x627ffe68)
      	category:"Scripted"
      (
      	parameters main rollout:params
      	(
      		radius			type:#float	  default:25.0 	ui:ui_radius;
      		numpnts			type:#integer	  default:100 	ui:ui_numpnts;
      		rseed			type:#integer	  default:0 	ui:ui_rseed;
      	)	
      	
      	rollout params "Params"
      	(
      		spinner ui_radius   "Radius:" range:[0, 1e9, 0] fieldwidth:64 type:#float align:#right;
      		spinner ui_numpnts  "Num. Points:" range:[0, 1e9, 0] fieldwidth:64 type:#integer align:#right;
      		spinner ui_rseed   "Seed:" range:[0, 1e9, 0] fieldwidth:64 type:#integer align:#right;
      	)	
      
      	fn randomPntInSphere r =
      	(
      		pnt = [0,0,0]
      		do( pnt = random [-1,-1,-1] [1,1,1] )while pnt.x * pnt.x + pnt.y * pnt.y + pnt.z * pnt.z > 1.0f;
      		pnt *= r;
      	)	
      	
      on attachedToNode nde do nde.vertexTicks = on;
   
      -- viewport create	
      	
      	tool create
      	(
      		 on mousePoint click do case click of
      		 (
      			 1: 
      			 (
      				 nodeTM.translation = gridPoint
      				radius = 0.01;
      			 )
      			 2: #stop
      		 )
      		 on mouseMove click do case click of
      		 (
      			 2:  radius = length [gridDist.x,gridDist.y]
      		 )
      	)
      		
      	fn doBuildMesh =
      	(
      		nverts = numpnts;
      		seed rseed
      		
      		setNumVerts mesh nverts;
      		
      		for v = 1 to nverts do
      			setvert mesh v (randomPntInSphere radius)
      		update mesh;
      	)
      	on update do doBuildMesh();
      	on buildmesh do doBuildMesh();
      )
      
pretty trivial to then add randomPntInBox,  randomPntInCylinder, randomPntInCone, randomPntInCapsule, randomPntInMesh etc

edit to add the vertex ticks bit saves adding an edit mesh mod so you can see the verts

sorry just ignore me got the wrong end of the stick from your post

Let me rephrase that question too I have an object plugin that the geo display options would be display as…
face
box
point cloud <– this is where I would like to dynamical just display % of verts only
or
original geo

ok, a second option for what I’m working on would be an object plugin that shared 2 type of classes in one node. Like a geo that displayed points on some verts but be the same object.

Thinkbox software did this with their Xmesh and Frost plugin. It has a mix from spline logo and geo display all in the same node.

Any thoughts on this would be great
thanks