#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0

    File Handling using c++


    from this file i have extracted the floating points successfully but...if u notice the following data has some data which repeats itself so i want to de duplicate those entries,,,,how to do that..
    pls help

    solid CONE
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex 4.755336e+01 1.500000e+02 -1.544857e+01
    vertex -4.755336e+01 1.500000e+02 -1.544857e+01
    vertex -5.000000e+01 1.500000e+02 0.000000e+00
    endloop
    endfacet
    facet normal -9.381535e-01 -3.127178e-01 -1.485786e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex -5.000000e+01 1.500000e+02 0.000000e+00
    vertex -4.755336e+01 1.500000e+02 -1.544857e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex 5.000000e+01 1.500000e+02 0.000000e+00
    vertex 4.755336e+01 1.500000e+02 -1.544857e+01
    vertex -5.000000e+01 1.500000e+02 0.000000e+00
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex -4.755336e+01 1.500000e+02 1.544857e+01
    vertex 5.000000e+01 1.500000e+02 0.000000e+00
    vertex -5.000000e+01 1.500000e+02 0.000000e+00
    endloop
    endfacet
    facet normal -9.381535e-01 -3.127178e-01 1.485786e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex -4.755336e+01 1.500000e+02 1.544857e+01
    vertex -5.000000e+01 1.500000e+02 0.000000e+00
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex 4.045117e+01 1.500000e+02 -2.938805e+01
    vertex -4.045117e+01 1.500000e+02 -2.938805e+01
    vertex -4.755336e+01 1.500000e+02 -1.544857e+01
    endloop
    endfacet
    facet normal -8.463282e-01 -3.127150e-01 -4.312052e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex -4.755336e+01 1.500000e+02 -1.544857e+01
    vertex -4.045117e+01 1.500000e+02 -2.938805e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex 4.755336e+01 1.500000e+02 -1.544857e+01
    vertex 4.045117e+01 1.500000e+02 -2.938805e+01
    vertex -4.755336e+01 1.500000e+02 -1.544857e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex 2.938805e+01 1.500000e+02 -4.045117e+01
    vertex -2.938805e+01 1.500000e+02 -4.045117e+01
    vertex -4.045117e+01 1.500000e+02 -2.938805e+01
    endloop
    endfacet
    facet normal -6.716435e-01 -3.127138e-01 -6.716435e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex -4.045117e+01 1.500000e+02 -2.938805e+01
    vertex -2.938805e+01 1.500000e+02 -4.045117e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex 4.045117e+01 1.500000e+02 -2.938805e+01
    vertex 2.938805e+01 1.500000e+02 -4.045117e+01
    vertex -4.045117e+01 1.500000e+02 -2.938805e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex 1.544857e+01 1.500000e+02 -4.755336e+01
    vertex -1.544857e+01 1.500000e+02 -4.755336e+01
    vertex -2.938805e+01 1.500000e+02 -4.045117e+01
    endloop
    endfacet
    facet normal -4.312052e-01 -3.127150e-01 -8.463282e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex -2.938805e+01 1.500000e+02 -4.045117e+01
    vertex -1.544857e+01 1.500000e+02 -4.755336e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex 2.938805e+01 1.500000e+02 -4.045117e+01
    vertex 1.544857e+01 1.500000e+02 -4.755336e+01
    vertex -2.938805e+01 1.500000e+02 -4.045117e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex 1.544857e+01 1.500000e+02 -4.755336e+01
    vertex -3.061617e-15 1.500000e+02 -5.000000e+01
    vertex -1.544857e+01 1.500000e+02 -4.755336e+01
    endloop
    endfacet
    facet normal -1.485786e-01 -3.127178e-01 -9.381535e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex -1.544857e+01 1.500000e+02 -4.755336e+01
    vertex -3.061617e-15 1.500000e+02 -5.000000e+01
    endloop
    endfacet
    facet normal 1.485786e-01 -3.127178e-01 -9.381535e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex -3.061617e-15 1.500000e+02 -5.000000e+01
    vertex 1.544857e+01 1.500000e+02 -4.755336e+01
    endloop
    endfacet
    facet normal 4.312052e-01 -3.127150e-01 -8.463282e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex 1.544857e+01 1.500000e+02 -4.755336e+01
    vertex 2.938805e+01 1.500000e+02 -4.045117e+01
    endloop
    endfacet
    facet normal 6.716435e-01 -3.127138e-01 -6.716435e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex 2.938805e+01 1.500000e+02 -4.045117e+01
    vertex 4.045117e+01 1.500000e+02 -2.938805e+01
    endloop
    endfacet
    facet normal 8.463282e-01 -3.127150e-01 -4.312052e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex 4.045117e+01 1.500000e+02 -2.938805e+01
    vertex 4.755336e+01 1.500000e+02 -1.544857e+01
    endloop
    endfacet
    facet normal 9.381535e-01 -3.127178e-01 -1.485786e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex 4.755336e+01 1.500000e+02 -1.544857e+01
    vertex 5.000000e+01 1.500000e+02 0.000000e+00
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex -4.755336e+01 1.500000e+02 1.544857e+01
    vertex 4.755336e+01 1.500000e+02 1.544857e+01
    vertex 5.000000e+01 1.500000e+02 0.000000e+00
    endloop
    endfacet
    facet normal 9.381535e-01 -3.127178e-01 1.485786e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex 5.000000e+01 1.500000e+02 0.000000e+00
    vertex 4.755336e+01 1.500000e+02 1.544857e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex -4.045117e+01 1.500000e+02 2.938805e+01
    vertex 4.045117e+01 1.500000e+02 2.938805e+01
    vertex 4.755336e+01 1.500000e+02 1.544857e+01
    endloop
    endfacet
    facet normal 8.463282e-01 -3.127150e-01 4.312052e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex 4.755336e+01 1.500000e+02 1.544857e+01
    vertex 4.045117e+01 1.500000e+02 2.938805e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex -4.755336e+01 1.500000e+02 1.544857e+01
    vertex -4.045117e+01 1.500000e+02 2.938805e+01
    vertex 4.755336e+01 1.500000e+02 1.544857e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex -2.938805e+01 1.500000e+02 4.045117e+01
    vertex 2.938805e+01 1.500000e+02 4.045117e+01
    vertex 4.045117e+01 1.500000e+02 2.938805e+01
    endloop
    endfacet
    facet normal 6.716435e-01 -3.127138e-01 6.716435e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex 4.045117e+01 1.500000e+02 2.938805e+01
    vertex 2.938805e+01 1.500000e+02 4.045117e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex -4.045117e+01 1.500000e+02 2.938805e+01
    vertex -2.938805e+01 1.500000e+02 4.045117e+01
    vertex 4.045117e+01 1.500000e+02 2.938805e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex -1.544857e+01 1.500000e+02 4.755336e+01
    vertex 1.544857e+01 1.500000e+02 4.755336e+01
    vertex 2.938805e+01 1.500000e+02 4.045117e+01
    endloop
    endfacet
    facet normal 4.312052e-01 -3.127150e-01 8.463282e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex 2.938805e+01 1.500000e+02 4.045117e+01
    vertex 1.544857e+01 1.500000e+02 4.755336e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex -2.938805e+01 1.500000e+02 4.045117e+01
    vertex -1.544857e+01 1.500000e+02 4.755336e+01
    vertex 2.938805e+01 1.500000e+02 4.045117e+01
    endloop
    endfacet
    facet normal 0.000000e+00 1.000000e+00 0.000000e+00
    outer loop
    vertex -1.544857e+01 1.500000e+02 4.755336e+01
    vertex -3.061617e-15 1.500000e+02 5.000000e+01
    vertex 1.544857e+01 1.500000e+02 4.755336e+01
    endloop
    endfacet
    facet normal 1.485786e-01 -3.127178e-01 9.381535e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex 1.544857e+01 1.500000e+02 4.755336e+01
    vertex -3.061617e-15 1.500000e+02 5.000000e+01
    endloop
    endfacet
    facet normal -1.485786e-01 -3.127178e-01 9.381535e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex -3.061617e-15 1.500000e+02 5.000000e+01
    vertex -1.544857e+01 1.500000e+02 4.755336e+01
    endloop
    endfacet
    facet normal -4.312052e-01 -3.127150e-01 8.463282e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex -1.544857e+01 1.500000e+02 4.755336e+01
    vertex -2.938805e+01 1.500000e+02 4.045117e+01
    endloop
    endfacet
    facet normal -6.716435e-01 -3.127138e-01 6.716435e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex -2.938805e+01 1.500000e+02 4.045117e+01
    vertex -4.045117e+01 1.500000e+02 2.938805e+01
    endloop
    endfacet
    facet normal -8.463282e-01 -3.127150e-01 4.312052e-01
    outer loop
    vertex 0.000000e+00 0.000000e+00 0.000000e+00
    vertex -4.045117e+01 1.500000e+02 2.938805e+01
    vertex -4.755336e+01 1.500000e+02 1.544857e+01
    endloop
    endfacet
    endsolid CONE
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    Sorry, don't have the time to look at all the entries. Can you point out which two are duplicate? As far as I can see, each facet has a different set of vertices.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0
    Originally Posted by Scorpions4ever
    Sorry, don't have the time to look at all the entries. Can you point out which two are duplicate? As far as I can see, each facet has a different set of vertices.
    there are a lot of them..actually the vertex are common.....in the first facet the second vertex is same as the third vertex in second facet...
    THANX
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    I don't think you understand the structure of your input data file at all. Your main input data is facets and the facets are defined by a set of vertices. It is ok for two facets to share the same vertex (especially if the two facets meet at that vertex or share an edge, for example). If two of the facets had the same 3 sets of vertices, then they are duplicates. However, if they share one or two vertices, that means that they share a common point or a common edge. If you start removing vertex data on the grounds that they are duplicated, how do you know how the facets are connected to each other??

    If you think you should be removing duplicate vertices, I don't think you've thought your data model correctly in the first place.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo