![]() Note: As always for functions that take 3D vector inputs, there is a setVertexTangentBasisX2D with the same signature, which expects 2D vector inputs. The length should be the number of vertices in the mesh. The type should be adaptable to a 3-vector array of floats. vectors is an array of one 3D vector at each vertex.Specify the tangent coordinates at vertices, by giving the direction of the x-axis of the basis. void SurfaceMesh :: setVertexTangentBasisX ( const T & vectors ) To do so, pass an array of the x-axis vectors (in 3D) for mesh element. Before adding any tangent vector quantities, you probably need to tell Polyscope what this coordinate frame looks like. Tangent vectors are defined with respect to a coordinate frame at each vertex (resp., face). #include "polyscope/polyscope.h" #include "polyscope/surface_mesh.h" polyscope :: init () // Load mesh std :: unique_ptr mesh std :: unique_ptr geometry std :: tie ( mesh, geometry ) = loadMesh ( filename ) // Register the mesh with polyscope psMesh = polyscope :: registerSurfaceMesh ( "mesh", geometry -> inputVertexPositions, mesh -> getFaceVertexList (), polyscopePermutations ( * mesh )) // Set vertex tangent spaces geometry -> requireVertexTangentBasis () VertexData vBasisX ( * mesh ) for ( Vertex v : mesh -> vertices ()) polyscope :: getSurfaceMesh ( "mesh" ) -> setVertexTangentBasisX ( vBasisX ) // Make a vector field VertexData vecField = /* some field */ // Register the field polyscope :: getSurfaceMesh ( "mesh" ) -> addVertexIntrinsicVectorQuantity ( "great vectors", vecField ) polyscope :: show () Specifying the tangent basis They are expressed as 2D vectors with X-Y coordinates in some basis frame at each mesh element.Įxample: visualizing tangent vectors with geometry-central Tangent vectors lie flat against the surface of the mesh. If you want to add 2D vectors (usually to a 2D mesh), addFaceVectorQuantity2D exists with the same signature. Note: the inner vector type of the input must be 3D dimensional, or you risk compiler errors, segfaults, or worse. The length should be the number of faces in the mesh. ![]() vectors is the array of vectors at faces.SurfaceMesh :: addFaceVectorQuantity ( std :: string name, const T & vectors )Īdd a vector quantity defined at the faces of the mesh. If you want to add 2D vectors (usually to a 2D mesh), addVertexVectorQuantity2D exists with the same signature. Passing VectorType::AMBIENT ensures vectors have the proper world-space length. The default setting is as a freely-scaled value, which will be automatically scaled to be visible. vectorType indicates how to interpret vector data.vectors is the array of vectors at vertices.SurfaceMesh :: addVertexVectorQuantity ( std :: string name, const T & vectors )Īdd a vector quantity defined at the vertices of the mesh. Ambient vectorsĪmbient vectors are “standard” vectors, which have X-Y-Z vector coordinates in world space. ![]() M_MyThirdVector = m_MyTransform.Visualize vector-valued data at the elements of a surface mesh. Set the third vector to the GameObject you set in the Inspector's position Set the first vector to be at (0, 0, 0) You must assign to this Transform in the Inspector (could be another GameObject) Set this Vector in the Inspector (the position you would like the GameObject to move to) Use these to set the GameObject's position Use the No function dropdown to assign one Button with the ZeroButton method, one with PositiveButton method and the other with the GameObjectButton method. Also create 3 UI Buttons ( Create> UI> Button) and go to each of their Inspectors to change their OnClick method (click the + button) Attach a GameObject in the MyTransform field Change the “Second Vector” in the Inspector Click on the GameObject and the Inspector window appears. This script shows how a GameObject can be moved to new positions using vectors.
0 Comments
Leave a Reply. |