Number of vertices in shape

Hello,
I have the following problem:
I load an .obj file containing a certain number of vertices into my Java3D application
ObjectFile f = new ObjectFile();Then I access these vertices/coordinates via
GeometryInfo gi = new GeometryInfo((GeometryArray)shape.getGeometry());
GemometryArray ga = gi.getGeometryArray();
// create array which holds vertices as Point3d
verticesArr = new Point3d[ga.getVertexCount()]
// fill in array with all vertices
for (int i=0; i<ga.getVertexCount(); i++) {
verticesArr[i] = new Point3d();
ga.getCoordinates(i, verticesArr);
My problem is, that the number of vertices (i.e. ga.getVertexCount) in the loaded shape does not equal the number of vertices in the original file that I load!
How can that be? Does Java3D increase the number of vertices or am I getting something wrong?
Thanks

Any idea how I can access each coordinate one by one
and do my calculation?yup.. i have done this but my object is WAY more simple than your one. What i done is first get all the points (this will include repetitions as u have found out):
Enumeration en = obj.getAllGeometries();
TriangleStripArray tsa = (TriangleStripArray)en.nextElement();
points = new Point3d[tsa.getVertexCount()];
//initialise array
for(int i = 0; i<points.length;i++)
points[i] = new Point3d();
tsa.getCoordinates(0,points);
then i search through the repetitions and place any repeating point3d with null:
//copies 'null' into repetitions of points
for(int i = 0; i<points.length; i++){
for(int j = i+1; j < points.length; j++){
if(points[i] == null || points[j] == null );
else if( points.equals(points[j]) ){
points[j] = null;
i have done this in my initialisation stage to save me having to repeatedly work out the same vertices over and over again. what u could then do is to store the final set of Point3d's in a new array or into a Vector.

Similar Messages

  • Total number of vertices

    Hi,
    Is there a function to find the TOTAL NUMBER OF VERTICES in a polygon (2-dimentional polygon) that stored in spatial?
    Please help.
    Thanks.

    yes, there is.
    SDO_UTIL.GETNUMVERTICES
    Format
    SDO_UTIL.GETNUMVERTICES(
    geometry IN SDO_GEOMETRY
    ) RETURN NUMBER;
    Description
    Returns the number of vertices in the input geometry.
    Parameters
    geometry
    Geometry for which to return the number of vertices.
    thanks
    baris

  • Printing 'material number' in vertical manner in smartforms

    i am printing a smartforms where in the output i have to print a variable in the vertical format.... how can i rotate the variable to print it in the vertical manner... please do help me out.... its very urgent.....

    Hi
    if you want to print only 'material number' text in secondary window... make secondary window width minimal 1 ch and increase the height of window
    you will get the result in Veritical. result for materi number.
    if you want to print material number variable in mainwindow / seconarday window ,
    Create a font using SE73 , go to System barcode - change mode
    select the line "KUNAUNR  Kundenauftragsnumme", dbclick. , you can see
    no barcode type mentioned, like this, create new barcode sytem font and finally give the rotation % , we have 4 different %, 0, 90,180,  270, you this font in your character font/ paragraph font, you can get the result. but make sure printer should support this functionality
    Sriram Chellappa

  • Animating vertices in shapes

    hello guys
    i have a question regarding the drawing api and animating the
    resulting drawn images.
    im using flash cs3 (actionscript 3 of course) and need to
    draw in some skewed rectangular shapes, where i can control where
    each of the 4 points of the rectangle are (because the shapes are
    not necessarily straight angled). from what i've seen, i need to
    use the lineTo commands (as opposed to drawRect) because of this.
    then, i need to animate each of the 4 vertices of these
    shapes in an independent fashion. i really want to use the new
    Tween libraries (seem to be more effiicient than enterFrames), but
    these seem designed to animate only the object as a whole (and not
    just the vertices of the object). because of this im being forced
    to use enterframes to redraw the shape, which i feel is missing the
    poing entirely of the Tween libraries.
    is there an effiicient way of doing this?
    thank you very much,
    federico

    You can create a frame animation.  What you will have is a series of layers each with a step in your progression.  You start by creating the first frame in the frame animation dialog box and turn on the visibility of the layer that you want in that first frame.  Then you create a new layer with your painting.  Then, leaving the original layer visible, you create a new frame.  What ever is visiable in your layer pallet will be visible in the created frame.

  • Visio 2010 Validation for Checking the number of a specific type of shape.

    I have written a rule for flowchart for checking the number of Start/End Shapes in a document.
    The FilterExpression is as follows:
    AGGCOUNT(FILTERSET(SHAPESONPAGE(), HASCATEGORY("Start/End"))) > 0
    The TestExpression is as follows:
    AGGCOUNT(FILTERSET(SHAPESONPAGE(),HASCATEGORY("Start/End"))) = 2
    (Since totally there are 2 shapes: 1 Start and 1 End Shape)
    However, it is not working. Can anybody tell me what is wrong in the expressions.

    Well, it worked for me, so I want to check that you modified the Start/End master to have the User.msvShapeCategories row with the value "Start/End", as I did?
    A Category is not a Master
    David J Parker MVP (Visio) http://blog.bvisual.net

  • Read a number from a variable, and rotate a shape

    Hey all,
    I'm using the variables panel in Illustrator to pull a data set I've got.
    For example there's 2 text variables and 1 number going from 0-359. I'm looking for a script which looks at the variable name and pulls the number, then uses that number to rotate a shape by that many degrees.
    I have no experience in scripting in illustrator, just hoping there's a wizard here who might be able to help?
    Thanks for any help,
    Dave

    IMO you either use the app's data driven graphics or script… to do this sort of work easier than trying to work with both… My guess would be to just read a CSV or TDT text file and do rotation your stuff… There are plenty of CSV examples in this forum ( should the crappy search work )

  • Large vertical gradients not working like examples

    Hello guys, now this seems to be a very straight forward thing to do and there are loads of tutorials about the subject. None of them are helping me get this right though, and I can't for the life of me figure out what's wrong...
    Im trying to create a simple gui component that has a vertical gradient, simple enough right... I create the sprite, and draw the gradient with beginGradientFill and a matrix with a 90 degree radian angle on it; but it stops working if the sprite has a long width, below is an exmaple of what I mean:
    package
    import flash.display.GradientType;
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.geom.Matrix;
    public class Main extends Sprite
    public function Main()
    var theWidth : Number = 800;
    var theHeight: Number = 100;
    var shape1:Shape = new Shape();
    var matrix:Matrix = new Matrix();
    matrix.createGradientBox(theWidth , theHeight, Math.PI*0.5, 0, 0);
    var colors:Array = [ 0xffffff, 0x000000];
    var alphas:Array = [ 100, 100];
    var ratios:Array = [ 0, 255];
    shape1.graphics.lineStyle(2,0xa1b0b6);
    shape1.graphics.beginGradientFill(GradientType.LINEAR,colors, alphas, ratios, matrix);
    shape1.graphics.drawRect( 0.0, 0.0, theWidth , theHeight);
    shape1.graphics.endFill();
    addChild(shape1);
    If I change
    matrix.createGradientBox(800, 100, Math.PI*0.5, 0, 0);
    to
    matrix.createGradientBox(800, 100, Math.PI, 0, 0);
    it works fine - but horizontally - why is it that applying 90 degrees the fill does not work?
    Thanks for your help, I really don't know whats wrong with this

    Hi Rob, I'm really confused, if I create a new action script project and use the code i posted I get this:
    As you can see its not going from white to black, but instead it just looks grey - although there is a gradient, it looks like its massive or something :S I don't get it
    Im using flash builder 4, I create a new action script project, in the as file I paste that code into the constructor and run the application.
    ps.. yes i know about the alphas need to be 1, it was a typo when i posted this, setting them to 1 doesn't seem to be my issue. Any other ideas?

  • Vertical Clips Distorted in iMovie--How Can I Avoid the Distortion???

    I have a number of vertical clips (.mov) that I would like to include in a movie with the majority of clips which are horizontal. Although the vertical clips play fine (if I just play them on my computer), they become distorted when I import them into iMovie. iMovie changes their aspect ratio rather than scales them down to fit (leaving black bars on the left and right).
    Any ideas on what I can do to keep the original aspect ration with vertical orientation so that everyone in the movie does not look short and fat (the result of the distortion).
    Thanks for your help.

    David pointed to some excellent sites to help explain masks. QuickTime lets you do lots of things with masks, so it's not surprising your task is a bit different than most I saw there. To complicate matters, the QuickTime 7 user interface is different than the QT interface shown in those sites.
    Technically, a mask allows you to remove a portion of the video image. That's not exactly your goal if I understand it. Instead, you want to add to the image to prevent iMovie from resizing your vertically-shaped video when you import it. You want to make your video the normal size and shape so iMovie won't resize it, right?
    To do that, you need to place your vertical video in front of a black background that's the "proper" size. Essentially, you need to build a video sandwich that's the proper size for iMovie. When iMovie imports this video sandwich, it will accept it "as is" instead of resizing it. Then your video will play vertically in iMovie against a black background.
    Here's how:
    (This requires QuickTime Pro. These instructions are for QuickTime 7.):
    • In any graphics program, create a black image that's 640x480. Save it as a PICT. (I will assume your video is smaller than 640x480. If it's not, please say.)
    • In the Finder, make a duplicate of your vertical movie.
    • Open the duplicate in QuickTime Pro. From now on, we'll refer to this as "Vertical Movie".
    • Open the PICT in QT Pro. Select Edit > Copy. Close the PICT. The black picture is now on the Mac Clipboard.
    • Activate the Vertical Movie window. Choose Edit > Select All.
    • To add the black background to Vertical Movie, choose Edit > Add To Selection and Scale. That Pastes the PICT as a new layer which plays exactly the same duration as the current selection in the movie. (That's why we Selected All.)
    • The black layer now covers the video so you can't see it, and the playhead is at the end of the movie.
    • Move the playhead to the start of the movie.
    • To be able to see the video, we need to bring it forward in front of the black layer. To do that, choose Window > Show Movie Properties. This window shows the properties of each track in the movie, including Video Track 1 (your vertical video) and Video Track 2 (the black layer).
    • Click on "Video Track 1". Click on the "Visual Settings" tab below the track list.
    • At the bottom of the window change the Layer setting by clicking on the DOWN arrow just right of the Layer textbox. You want to make the Layer number smaller. -2 will probably do it. When the layer is correct, the video layer will appear. (If it doesn't appear, keep fiddling with the Layer until it does.)
    • If the video layer isn't centered against the black background, change its Offset settings so it is centered.
    • Save Vertical Movie. You've built your sandwich.
    • To make a movie iMovie will love, export the Vertical Movie sandwich to a DV Stream. To do that, choose File > Export. In the top popUp menu (at the bottom of the window) choose "Movie to DV Stream". In the bottom popUp, choose "DV NTSC 48 kHz". Assign a name and Save.
    (Exporting "flattens" the movie so the vertical video and the black background merge into a single layer.)
    • Import the DV Stream to iMovie.
    Karl

  • How to retrieve "KeyValue" from multiple Shape paths then "SetValue" to Mask path Keyframes?

    Hello AEScriptsComm.,..
    i have one question (hopefully the tutorer will answer soon), which is the goal and reason i'm learning ExtendScripts:
    I have a few dozen Adobe Illustrator, imported Shape Layers with paths "Created..from Vector Layers" in AEffects.
    In order to use a .jsxbin script to change every path to the same number of verticies for animating, i must 1st convert them to Keyframes on the same Mask Path property.
    1) i hoped to please be shown\sent an example showing how to,..
    a) Get\Retrieve "KeyValue" from multiple, single (Shape Layers):Outlines > Contents > Group > Path > Path as shown in screenshot "4-CreateShapeFromVecLyr2Outlines.JPG",
    and then,..
    b) "SetValue" from those paths into Mask > Mask Path keyframes also in screenshot "1-ExtendScript_ShapePathsTOMaskPathKeyframes.JPG"?
    Really appreciate any help soon as time allows,
    Jeff

    Hello Xavier,
                       esp. with my limited experience i can't determine how your concise script works.
    Because it 1st errors  esp. with undefines  i'm thinking at best its incomplete (or algorithm) to give me the gist and i'm to fill in the blanks, which i am doing with the sort of working code example pasted below.
    Its written with every  definition, declaration and initialization completed, so a novice like me can read the manuals, rev. eng. pertinant script(s), then with fragmented code and understanding quickly connecting to form a complete custom script, as we've all done.
    like this:
    var comp = app.project.activeItem:
    var layer  = comp.layers.addSolid([1,1,1,], layerName, comp.width, comp.height, 1.0, comp,duration);
    therefore,..
    var CompLayerSolid = app.project.activeItem.layers.addSolid([1,1,1,], layerName, comp.width, comp.height, 1.0, comp,duration);
    ..then with such direct access in other essentials, i can substitute compatible properties, methods,  parameters etc. and remaining code that affect the layer objects i need to control simultaneously. Also thereby learning more complex code quickly enough to use.
    Only, i hoped to save time here by those already familiar.
      But by comparison your script without declarations or many references in AE's CS6 Scripting Guide and online, i can't decipher or understand,
    although you wrote this more complete segment at CCow:
    "shapeLayer.content.addProperty("ADBE Vector Graphic - Fill");",
    ..in which is the addProperty i 1st looked for in your script after erroring with "ShapeLayer is undefined"
    But i could'nt find a ref. to either .content or content. anywhere in ExtendScript, nor "targetLayer.mask", and "targetLayer" i found once in ref. to ExtendScript as an AE layer name. So perhaps their your variables?, you see i can't determine or use.
    i don't know that was'nt meant, maybe a bit to tell me do my own research?,  no offence, can't confirm that without reply, hope you will, but my research is why i'm here and your probably advanced script could only help with your assistance.
    Thanks anyway,
    Cheers.
    function()
    var comp = app.project.activeItem;
    var masksLayer = comp.selectedLayers[0];
    var masksGroup = masksLayer.property("ADBE Mask Parade");
    app.beginUndoGroup(rd_MasksToShapesData.scriptName);
    // Create an empty shape lay
    // Get the mask layer's pixel aspect; if layer has no source, use comp's pixel aspect
    var pixelAspect = (masksLayer.source != null) ? masksLayer.source.pixelAspect : 1.0; //copixelAspect;
    // Iterate over the masks layer's masks, converting their paths to shape paths
    var mask, maskPath, vertices;
    for (var m=1; m<=masksGroup.numProperties; m++)
    var suffix = " Shapes";
    var shapeLayer = comp.layers.addShape();
    shapeLayer.name = masksLayer.name.substr(0,31-suffix.length) + suffix;
    shapeLayer.moveBefore(masksLayer);
    var shapeLayerContents = shapeLayer.property("ADBE Root Vectors Group");
    var shapeGroup = shapeLayerContents; //.addProperty("ADBE Vector Group");
    //shapeGroup.name = "Masks";
    var shapePathGroup, shapePath, shapePathData;
    // Get mask info
    mask = masksGroup.property(m);
    maskPath = mask.property("ADBE Mask Shape");
    // Create new shape path using mask info
    shapePathGroup = shapeGroup.addProperty("ADBE Vector Shape - Group");
    shapePathGroup.name = mask.name;
    shapePath = shapePathGroup.property("ADBE Vector Shape");
    shapePathData = new Shape();
    // ...adjust mask vertices (x axis) by pixel aspect
    vertices = new Array();
    for (var v=0; v<maskPath.value.vertices.length; v++){
    vertices[vertices.length] = [maskPath.value.vertices[v][0] * pixelAspect, maskPath.value.vertices[v][1]];
    shapePathData.vertices = vertices;
    shapePathData.inTangents = maskPath.value.inTangents;
    shapePathData.outTangents = maskPath.value.outTangents;
    shapePathData.closed = maskPath.value.closed;
    shapePath.setValue(shapePathData);
    shapeLayer.transform.anchorPoint.setValue(masksLayer.transform.anchorPoint.value);
    shapeLayer.transform.position.setValue(masksLayer.transform.position.value);
    shapeLayer.transform.scale.setValue(masksLayer.transform.scale.value);
    if (masksLayer.threeDLayer)
    shapeLayer.threeDLayer = true;
    shapeLayer.transform.xRotation.setValue(masksLayer.transform.xRotation.value);
    shapeLayer.transform.yRotation.setValue(masksLayer.transform.yRotation.value);
    shapeLayer.transform.zRotation.setValue(masksLayer.transform.zRotation.value);
    shapeLayer.transform.orientation.setValue(masksLayer.transform.orientation.value);
    else
    shapeLayer.transform.rotation.setValue(masksLayer.transform.rotation.value);
    shapeLayer.transform.opacity.setValue(masksLayer.transform.opacity.value);
    // Match the mask layer's transfor
    // Mute the mask layer
    masksLayer.enabled = false;
    app.endUndoGroup();

  • Is there a limit to the number of points in a polygon?

    Please excuse the entry-level question (and possible use of words like 'point' in a non-technically-precise way) but we've lost out Spatial expert!
    Anyway, we get problems occassionally with complex polygons and it seems that there's a limit fo the number of points they can have.
    Are we able to set a higher limit?

    SQL> desc MDSYS.SDO_ORDINATE_ARRAY
    MDSYS.SDO_ORDINATE_ARRAY VARRAY(1048576) OF NUMBERSo this means you have have a maximum of 1048576 ordinates in your ordiante array. So that would be 1048576/2 vertices if your data is 2d, or 1048576/3 if you have z or m values.
    However... you can change this if you really need to.
    See [Increasing the Size of Ordinate Arrays to Support Very Large Geometries|http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11830/sdo_migrat.htm#SPATL1426]
    I recommend you don't make this change unless you need to as it adds a bit of overhead if you want to export the data later.
    Its always worth thinking about why your polygons are so big. Maybe they are country boundaries and there are vertices every few metres and maybe you need this level of data in your system. Or maybe the data was captured in this way, but that level of details is meaningless in your context and you'd be better off by simplifying it (i.e. reducing the number of vertices). Or maybe the polygons have lots of duplicate vertices that should be removed.
    Only you can answer those questions but you need to be aware that the performance of polygons with huge number of vertices is likely to suck.

  • Point-in-polygon performance  -large polygon w many vertices

    Dear Everybody,
    I was experimenting with the performance of point-in-polygon queries for very different polygon layers. My experience was that queries can be extreme slow, if the polygons are large and have many vertices (e.g., the administrative boundary of a state).
    I could also explain, why this is so:
    *because of the large area, geographic indices do not help: after the first filtering step (the filtering on the basis of the indices) the immediate result  is still very large, and
    * the large number of potential hits after the first filtering step have to be processed in a - due to the many vertices - very processor intensive second filtering step.
    That is, there are two causes making the second filtering step very expensive.
    Could you please comment on this? Does anybody have any experiences?
    Thanks in advance!

    Hi Gergely,
    Thanks for your suggestion, I am thinking about that too. But the polygon I am using is dynamically built by user when they use the application. They choose some lines, and then I build a buffer around those lines based on some parameters user input, and it could get complicated since it varies all the time. I was thinking maybe there is a parameter in sdo_buffer function, which should allow to reduce the number of vertices used to build the buffer polygon? kind of stumped in this problem. maybe I should open a TAR to request better solution. A query which sometimes takes a hour to finish is obviously not acceptable, although it is not always the case. :-(
    Tim

  • How to create evenly spaced vertical rows?

    Hello!
    I need to create a grid with evenly spaced columns and rows, so what I basically need is the ability to vertically subdivide a frame in a number of steps, something similar to the "number of columns" input box for a text frame.
    Currently my workaround is to create a text frame, turn it 90 degrees and then apply the "number of columns" command to the desired number of vertical subdivisions I need (I like this option cos' it provides a gutter between the rows). Is there something faster?

    Set up the column width on that page to the value you need for spacing.
    Draw a rectangle/text frame/graphic frame and
    as you draw (don't release the mouse button) work with the arrow keys up and down.
    Or go to Layout > Create guide lines and add your values there and draw your rectangles between these guide lines.

  • Limit the number of records per page in webi

    Hello All,
    How do i limit the number of records per page in webi?
    i was asked to have not more than 20 records per page.
    In " NUmber of Vertical records per page"(Quick display mode) the default value was 100, i am trying to set it to 20 ...but its not updating....its still taking 100.
    I am on BO XI 3.1 Sp2 fix pack 3
    Please let me know a way to accomplish this.Any inputs appreciated
    Thanks

    It can be done as follows:
    1. create a variable at report level as:
            v Test = Floor(RowIndex()/20)
    2. Added this variable in the Block as a new column.
    3. Select the v Test column, Right Click and set as section (also you can apply break).
    4. Go to structure mode select section\break and go to properties tab and select the property "Start on new page".
    Regards,
    Rohit

  • Waveform-Graph - Specify number of divisions (lines)

    Hello,
    is there a way to set the number of vertical and horicontal lines in a waveform-graph?
    I want to change the look that it looks like an osciloscope-display with 10x8 divisions.
    Is this posibble?
    Thx

    Hi OnlyOne,
    so you don't want to use gridlines? You want some kind of overlay?
    Options:
    1) Put a picture indicator on top of your graph. Make it transparent background. Draw lines as needed - and you can choose any color...
    2) In LV8+ you can put a picture in the background of a graph. So create a picture like in point 1 and set it as background in your graph (using property node).
    3) Create property nodes for your decorations and change the color of those lines: Open reference to vi, get panel -> decorations[] -> colors... Or use the coloring tool ("brush") at edit time!
    Why not use gridlines of the graph?
    Message Edited by GerdW on 05-14-2008 01:28 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • XML QUESTION: Vertical Navbar - Flush Right?  How?

    Following Paul Haan's instructions, I figured out how to make a
    Vertical
    Navbar
    That
    Stacks
    Like
    This
    However, I can't seem to figure out the code to make the bar flush right
    instead of flush left. I can do center as well, but I want flush right!
    Anyone know the code?

    <sf:navbar-orientation><sf:number sfa:number="0" sfa:type="i"/></sf:navbar-orientation>
    sfa number 0=vertical navbar, 1=horizontal navbar
    <sf:navbar-horizontal-alignment><sf:number sfa:number="2" sfa:type="i"/></sf:navbar-horizontal-alignment>
    sfa number 2 = center, 3 = flush left, 4 = flush right
    (But these settings only work for horizontal navbars, not vertical! Grrrrr!)
    WaiT
    One workaround is to use the horizontal navbar setting, use "4" for horizontal alignment, then adjust margins like so:
    was
    <sf:navbar-margins><sf:padding sfa:ID="SFWPPadding-15" sf:top="10" sf:left="35" sf:bottom="7" sf:right="35"/></sf:navbar-margins>
    change to
    <sf:navbar-margins><sf:padding sfa:ID="SFWPPadding-15" sf:top="10" sf:left="35" sf:bottom="7" sf:right="635"/></sf:navbar-margins>
    By changing sf:right from "35" to "635" it forces the horizontal navbar into a really narrow column width, thus forcing a line break on every menu item and flush right alignment.
    Still, there has to be a better way . . .

Maybe you are looking for

  • Em bug - is there a workaround?

    Hi I'm using Dreamweaver CS3 for Windows. On the Insert + Text toolbar, there is an "I" button and an "em" button; but *both* buttons insert <em> tags!! The only way I have found to insert <i> tags is by working in the code window and typing the tags

  • Hue Saturation Luminance - Galer

    I am working through Galer's  Elements 8 - Maximum Performance and have had only little trouble until Project 5, Hue Saturation & Luminance.  When using the Smart Brush Tool, in the options bar there are presets in the video that are not part of the

  • The command "feather" and/or "set" is not available

    Greetings all. I am having problems with various actions in PS 11 that all seem to work fine in PS 10. It's primarily either "the command feather is not available" or "the command set is not available". These problems don't occur when I run the actio

  • User menu + data aquisition + Report === ???

    Hi guys. I am working on a program that asks the user for the input then it takes the data saves the data in excel file. After the user clicks on the STOP button it opens the file and puts it in a report template. I am asking you to review my program

  • Como cambiar de cuanta d un iPhone

    Como cambiar una cuanta debitó es de un iPhone y ponerle otra en su lugar